Sponsored Content
Top Forums UNIX for Advanced & Expert Users Identify tables from Oracle sql scripts Post 303044132 by techmoris on Friday 14th of February 2020 01:35:29 PM
Old 02-14-2020
Identify tables from Oracle sql scripts

Hi,

Please let me know if you have any thoughts on how to read a table that has all the oracle sql files or shell scripts at the job and step level to identify all the tables that does merge, update, delete, insert, create, truncate, alter table (ALTER TABLE XYZ RENAME TO ABC) and call them out separately to write to table and to a file as well. We have thousands of jobs and trying to write a script to gather all these details into a table and file.

Table Name: Steps
Code:
JOB_ID	STEP_ID	Script_Name
12345   	1	                xfer_process.sh
12345     2	                merge_process.sql
12345     3	                load_step.sql

Table Name: Schedule
Code:
JOB_ID SCHEDULE
12345      DAILY 8 AM
5678       EVERY WEDNESDAY 10 AM
8989       DAILY 4 PM

Output
Code:
JOB ID	STEP_ID 	Script_Name	Dependent_Job	Succeeding _Job	Dependent_Job_Schedule 	Succeeding _Job_Schedule	SCHEMA_XF Read	SCHEMA_XF Build	SCHEMA_XF Insert	SCHEMA_XF Update	SCHEMA_XF Delete	SCHEMA_XF Truncate	SCHEMA_XF Merge	SCHEMA_XF Swap

Column SCHEMA_XF Build means create table as select * from table a
Column SCHEMA_XF Swap means alter table a rename to b

Thank you
Moderator's Comments:
Mod Comment
Please use code tags for output and code.
Thanks!

Last edited by Peasant; 02-14-2020 at 03:11 PM.. Reason: Added code tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

finding out tables not used in scripts.

Hi all, Please see my requirement and post me asap. Spool all the tables names into a file . Take each table name and check if it is present in any of the scripts in a directory using grep -il command. The script has to loop through the tables list and take each table and find it's presence... (7 Replies)
Discussion started by: Vasundhara
7 Replies

2. Shell Programming and Scripting

use shell scripts to update tables from databases

Hi I need to write a shell script that will access tables available on webpages and update a table on my webpage on a periodic basis. It will access, say for example a website that periodically update a table with certain quantities and update my table accordingly.it should have the flexibility... (0 Replies)
Discussion started by: wannabegeek
0 Replies

3. Shell Programming and Scripting

Calling SQL LDR and SQL plus scripts in a shell script

Hi- I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment... I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies

4. Shell Programming and Scripting

tables in scripts

Hi , I have two tables with same length t1 and t2, I want to cretae a new third table where i put the difference between the elements of t2 and t1, t3= t1 - t2 t3= t1 - t2 I am new to scripts, any help please? thanks (7 Replies)
Discussion started by: Celine19
7 Replies

5. Programming

SQL Add to Multiple Tables

I'm pretty new to the database world and I've run into a mental block of sorts. I've been unable to find the answer anywhere. Here's my problem: I have several tables and everything is as normalized as possible (as I've been lead to understand normalization.) Normalization has lead to some... (1 Reply)
Discussion started by: flakblas
1 Replies

6. Shell Programming and Scripting

Execute multiple SQL scripts from single SQL Plus connection

Hi! I would like to do a single connection to sqlplus and execute some querys. Actually I do for every query one connection to database i.e echo 'select STATUS from v$instance; exit' > $SQL_FILE sqlplus user/pass@sid @$SQL_FILE > $SELECT_RESULT echo 'select VERSION from v$instance;... (6 Replies)
Discussion started by: guif
6 Replies

7. UNIX for Advanced & Expert Users

Call parallel sql scripts from shell and return status when both sql are done

Hi Experts: I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies

8. Programming

Query to join two tables in SQL

Hi, I have 2 tables. Table1 name map_code data_code id aaa 2732C 3333B 10 bbb 1223F 2545v 11 ccc 12 Table2 name map_code data_code id text_description aaa 2732C 3333B 10 description 1 bbb 1223F 2545v 11 ... (3 Replies)
Discussion started by: vanitham
3 Replies

9. Shell Programming and Scripting

Scripts for exporting backup from selected tables of Oracle DB

dear all please help me ! i need a script for exporting the selected tables of oracle database installed on CentOs. i waiting your response. thanks and regards (6 Replies)
Discussion started by: amirzargaran
6 Replies

10. UNIX and Linux Applications

Identify a specific environment Oracle variable to connect a remote Oracle database ?

Good evening I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus. I tried to find out the user/passwd and service name by env variable and all Ive got is this: ORACLE_SID_REPCOL=SCL_REPCOL ORACLE_SID=xmeta ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies
DBIx::Class::Admin(3)					User Contributed Perl Documentation				     DBIx::Class::Admin(3)

NAME
DBIx::Class::Admin - Administration object for schemas SYNOPSIS
$ dbicadmin --help $ dbicadmin --schema=MyApp::Schema --connect='["dbi:SQLite:my.db", "", ""]' --deploy $ dbicadmin --schema=MyApp::Schema --class=Employee --connect='["dbi:SQLite:my.db", "", ""]' --op=update --set='{ "name": "New_Employee" }' use DBIx::Class::Admin; # ddl manipulation my $admin = DBIx::Class::Admin->new( schema_class=> 'MY::Schema', sql_dir=> $sql_dir, connect_info => { dsn => $dsn, user => $user, password => $pass }, ); # create SQLite sql $admin->create('SQLite'); # create SQL diff for an upgrade $admin->create('SQLite', {} , "1.0"); # upgrade a database $admin->upgrade(); # install a version for an unversioned schema $admin->install("3.0"); REQUIREMENTS
The Admin interface has additional requirements not currently part of DBIx::Class. See DBIx::Class::Optional::Dependencies for more details. ATTRIBUTES
schema_class the class of the schema to load schema A pre-connected schema object can be provided for manipulation resultset a resultset from the schema to operate on where a hash ref or json string to be used for identifying data to manipulate set a hash ref or json string to be used for inserting or updating data attrs a hash ref or json string to be used for passing additional info to the ->search call connect_info connect_info the arguments to provide to the connect call of the schema_class config_file config_file provide a config_file to read connect_info from, if this is provided config_stanze should also be provided to locate where the connect_info is in the config The config file should be in a format readable by Config::Any. config_stanza config_stanza for use with config_file should be a '::' delimited 'path' to the connection information designed for use with catalyst config files config Instead of loading from a file the configuration can be provided directly as a hash ref. Please note config_stanza will still be required. sql_dir The location where sql ddl files should be created or found for an upgrade. sql_type The type of sql dialect to use for creating sql files from schema version Used for install, the version which will be 'installed' in the schema preversion Previous version of the schema to create an upgrade diff for, the full sql for that version of the sql must be in the sql_dir force Try and force certain operations. quiet Be less verbose about actions trace Toggle DBIx::Class debug output METHODS
create Arguments: $sqlt_type, \%sqlt_args, $preversion "create" will generate sql for the supplied schema_class in sql_dir. The flavour of sql to generate can be controlled by supplying a sqlt_type which should be a SQL::Translator name. Arguments for SQL::Translator can be supplied in the sqlt_args hashref. Optional preversion can be supplied to generate a diff to be used by upgrade. upgrade Arguments: <none> upgrade will attempt to upgrade the connected database to the same version as the schema_class. MAKE SURE YOU BACKUP YOUR DB FIRST install Arguments: $version install is here to help when you want to move to DBIx::Class::Schema::Versioned and have an existing database. install will take a version and add the version tracking tables and 'install' the version. No further ddl modification takes place. Setting the force attribute to a true value will allow overriding of already versioned databases. deploy Arguments: $args deploy will create the schema at the connected database. $args are passed straight to "deploy" in DBIx::Class::Schema. insert Arguments: $rs, $set insert takes the name of a resultset from the schema_class and a hashref of data to insert into that resultset update Arguments: $rs, $set, $where update takes the name of a resultset from the schema_class, a hashref of data to update and a where hash used to form the search for the rows to update. delete Arguments: $rs, $where, $attrs delete takes the name of a resultset from the schema_class, a where hashref and a attrs to pass to ->search. The found data is deleted and cannot be recovered. select Arguments: $rs, $where, $attrs select takes the name of a resultset from the schema_class, a where hashref and a attrs to pass to ->search. The found data is returned in a array ref where the first row will be the columns list. AUTHOR
See "CONTRIBUTORS" in DBIx::Class. LICENSE
You may distribute this code under the same terms as Perl itself perl v5.18.2 2014-01-08 DBIx::Class::Admin(3)
All times are GMT -4. The time now is 05:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy