LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   copy translation tables from staging environment. (https://www.linuxquestions.org/questions/linux-newbie-8/copy-translation-tables-from-staging-environment-873798/)

smritisingh03 04-08-2011 11:04 AM

copy translation tables from staging environment.
 
Hi

I have 3 translation tables,i.e,camp_generic_trans
camp_generic_trans_def
camp_generic_trans_epc

these tables exist in cntr1/cntr1@camABC1


I have to copy these tables from here to staging environment.

I need to first check if any of the tables exist in staging.If yes,then delete and create new.
There are 4 staging env from 5 to 8.

I have to pass the staging environment as parameter to ask the user which environment does he want the tables to be copied.

Any suggestion would highly be appreciated as I am new to unix.Thank you so much in advance

harry edwards 04-08-2011 02:32 PM

This is not a solution; but, may help.

To check if a table exists you can run:

Code:

SELECT * FROM USER_TABLES WHERE TABLE_NAME='You Table Name';
Then you can check the result and delete the table if required:

Code:

DROP TABLE YOUR_TABLE_NAME;
Then create table:
Code:

CREATE TABLE YOUR_TABLE_NAME AS
(SELECT * FROM ORGINAL_TABLE_NAME);
COMMIT;

Or, insert the data:

Code:

INSERT INTO YOUR_TABLE_NAME
(SELECT * FROM ORGINAL_TABLE_NAME);
COMMIT;

I hope that helps.


All times are GMT -5. The time now is 03:49 AM.