Load Oracle tables and switch public synonym


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Load Oracle tables and switch public synonym
# 1  
Old 06-05-2006
Load Oracle tables and switch public synonym

I need some help from Oracle and UNIX expertise point of view.

I have two tables, METADATA_A and METADATA_B. I need to switch loading these tables. If we load METADATA_A today, the following
week we would have to load METADATA_B.

There is a public synonym "METADATA" that sits on top of these two tables.

1) Find out which table is in use right now..

Code:
SELECT * 
FROM ALL_SYNONYMS 
WHERE SYNONYM_NAME = "METADATA"

2) Truncate opposite table

3) Load opposite table

4) Validate by doing a count * on the table to check the rows loaded.

5) Finally, switch synonym

Can this be achieved using shell script? Please advice.
# 2  
Old 06-06-2006
Yes. I used to write perl scripts that would call Oracle SQL scripts. The perl script would be used to authenticate you to the database and then you would execute the SQL script from within your PERL script. It's been about 4 years since I've done it but it can be done.

-X
# 3  
Old 06-06-2006
Thank you X....

If anybody has encountered this situation, please help me with a sample shell script...

Put me in the track and I will work on it...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

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... (1 Reply)
Discussion started by: techmoris
1 Replies

2. Red Hat

How to switch back from Oracle Kernel to RedHat?

Hello friends, We have RHEL 7.5 server with latest updates. We needed to install Oracle 12 DB on it so chose "easy method" of installing "oracle-database-server-12cR2-preinstall-1.0-3.el7.x86_64.rpm" and then installed oracle DB. Everything went smooth and all OK but later we noticed that it has... (4 Replies)
Discussion started by: prvnrk
4 Replies

3. Shell Programming and Scripting

Multiple files to load into different tables

multiple files to load into different tables, I have a script show below, but this script loads data from txt file into a table, but i have multiple input files(xyzload.txt,xyz1load.txt,xyz2load.txt......) in the unix folder , can we load these files in diff tables (table 1, table2... (1 Reply)
Discussion started by: nani1984
1 Replies

4. Shell Programming and Scripting

Multiple files to load into different tables,

multiple files to load into different tables, I have a script show below, but this script loads data from txt file into a table, but i have multiple input files(xyzload.txt,xyz1load.txt,xyz2load.txt......) in the unix folder , can we load these files in diff tables (table 1, table2... (0 Replies)
Discussion started by: nani1984
0 Replies

5. 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

6. Programming

Oracle 10g tables dumps

HI All, I am using Oracle 10g . Want to take dumps(.dmp log) from many tables with where clause having same schema. ex : TB_MTH_ORA_CAB "WHERE TRUNC(dw_entry_dt )= TO_DATE('01-JAN-2011')" TB_AM_AT_OSS_MAT "WHERE TRUNC(dw_entry_date )>= TO_DATE('01-JAN-2011') AND TRUNC(dw_entry_date )<=... (4 Replies)
Discussion started by: Perlbaby
4 Replies

7. Shell Programming and Scripting

Load data from a flat file to oracle.

I have a flat file with records like Header 123 James Williams Finance2000 124 Pete Pete HR 1500 125 PatrickHeather Engg 3000 Footer The structure is: Eno:4 characters Name:8 characters Surname : 9 characters Dept:7 characters Sal:4characters These are sample... (1 Reply)
Discussion started by: Shivdatta
1 Replies

8. Shell Programming and Scripting

Reading data from multiple tables from Oracle DB

Hi , I want to read the data from 9 tables in oracle DB into 9 different files in the same connection instance (session). I am able to get data from one table to one file with below code : X=`sqlplus -s user/pwd@DB <<eof select col1 from table1; EXIT; eof` echo $X>myfile Can anyone... (2 Replies)
Discussion started by: net
2 Replies

9. Shell Programming and Scripting

To load data from variable to oracle table ....???

Hi all, How to load variable value into Oracle table? I have created a file validation shell script. After the validation completes, i need to update a Oracle table with the variable value... Can someone help me how to do it? I have searched, but not able to get answer. i have 4 variables... (2 Replies)
Discussion started by: Amit.Sagpariya
2 Replies

10. UNIX for Advanced & Expert Users

copying oracle tables from raw disk

I have been tasked with archiving Oracle tables. The data is on raw devices, and possibly will span multiple logical volumes. Has anyone ever had to do this? How did you accomplish it? Any references to accomplish this would be greatly appreciated. Thanks, (2 Replies)
Discussion started by: isenhart
2 Replies
Login or Register to Ask a Question