is it possible to search all Redshift procedures for text? - sql

I am dropping old tables from Redshift. Is it possible to search through all procedures to make sure a table is not referenced? It would be a lot easier than opening each one to search for text.
Thank you.

Consider using the unscanned_table_summary.sql query we provide on GitHub

Related

Create a dynamic list of tables used by all the dashboards on the server

Is it possible to create something which extracts all the database/table names being used by multiple dashboards? We have a lot of old and new dashboards and we wanted to extract which tables are being used by the dashboards.
You can give this a try
https://help.qlik.com/en-US/governance-dashboard/Content/QV_GovDashboard/What.htm
It has a data lineage tab that can show you some stuff and I imagine help you to build your own custom solution
Im not sure that this is possible. Or at least not easy to achieve. In order to extract such info:
loop through all apps and extract the script
parse the Qlik script and find/extract all sql statements
parse these statements and extract the database/tables
Extracting the scripts is the easiest part here.
Isolating the sql statements might be doable but then parsing the sql will have to be done by something.
There is no complete Qlik script parser so potentially using string manipulations to extract the sql statements (imo depends on the sql complexity). (I havent lost hope to complete qlik-script-parser but have to spend a lot of time on it in order to complete it)
There are tools (like sqlformat chose output to be List DB Object) that can extract tables and fields but not sure if automation can be achieved.

Finding duplicate documents in BLOB field of Oracle table (Oracle Text)

I need to somehow detect duplicate documents (.doc, .pdf, etc) which are stored in BLOB field of my table.
I've been looking into Oracle Text functionality, but failed to find something that can help me in achieving my goal.
In fact, i need something like UTL_MATCH functionality but with possible comparison of entire document in file.
Can someone provide me any tips on how to do that?
EDIT:
I'm not searching for absolutely same duplicates, which can be done through file comparison, I need to analyse text in documents, that's why I'm trying to use Oracle Text.

New table or using commas?

I want to learn your suggestions about that:
Using commas for product's categories
OR Creating a 3rd table.
Which one is more useful?
Thanks alot for your suggestions.
Creating a 3rd table is definitely the better option.
Using comma-delimited values is only going to cause you problems later down the line. It will also make writing SQL queries a lot more complex than they need, and the performance will be costed for this.

Exploring data dictionary tables usage in Oracle?

I am fresher and just started learning about database. But one thing strikes me, being a PL/SQL I should know all the data dictionary table, rather than relying on the options given in TOAD, SQL Developer. Like explain plan, search an object, locks, search a text in database and many more which we uses in daily life .
Can anyone contribute the tables or query which we can use in daily practices,rather than just clicking the button in tool, because it's not possible that everywhere we have this GUI interface to work with.
I think this will be very helpful for the people who really want to know what is working behind what option in our buttons.
For Example: The query below is use to search the string in all the database objects
Select *
FROM DBA_SOURCE
WHERE text LIKE '%<your text >%';
You are right: developers (and wannabe DBAs come to that) should know the Data Dictionary, rather than relying on an IDE. A good Oracle practitioner should be able to survive with just a text editor and SQL*Plus.
There are too many views to understand them all. You just need to know that they are all covered in the documentation. Find out more.
there are many different uses of the data dictionary from querying package sources, to database administration.
Burleson has a few here to get you started
http://www.dba-oracle.com/concepts/data_dictionary.htm
You can get a good list from the following select statement:
select table_name||': '||comments from dictionary;
That lists 838 rows. The ones you would use most are probably ALL_OBJECTS, ALL_TABLES, ALL_TAB_COLUMNS, ALL_VIEWS, ALL_SOURCE, ALL_COMMENTS, and (sometimes very important) ALL_SYNONYMS.
ALL_SOURCE is a good place to find documentation for Oracle's built-in packages, because the comments in the package specification tell you everything you need to know to use them. For example, look at DBMS_SQL.

How to merge multiple databases into one

Is there an easy way to combine two SQL Server 2005 databases into a single database? I want to take database 'A' and database 'B' and merge them both entirely into database 'C'.
Thanks!
It depends what you mean by "merge". If you have two disjoint sets of tables and want to transfer them into the same database structure, that's not a huge problem.
If you are needing to interleave or transform the data from A and/or B, they way to do it will be completely dependent on what you are trying to accomplish.
That's called "data conversion" in the business. It can be a full project in itself, there is no quick and dirty answer for your question.
I'm not sure if you want to do this by yourself or are looking for a tool that will help you. If latter is an option, take a look at RedGate's SQL Compare and SQL Data Compare. These tools will let you see the differences between the schemas(SQL Compare), as well as the data in each database(SQL Data Compare). Also, they're free for 14 days and fully functional during that period.
Hope this helps,
Srdjan
Right click the database and click export data, and then follow the wizard. Do the same for the other database.