How can I create backup script for selected tables in Oracle

157 Views Asked by At

I am using below script to create backup file but it takes backup of all tables. I want backup of selected tables. how can I achieve this.

imp <username>/<password>@<hostname> file=<filename>.dmp log=<filename>.log full=y;

Below script is working fine. select 'C:\Daily-MIS-Backup\'||TO_CHAR(SYSDATE,'YYYYMMDD-HH24MISS')||'.DMP' foo3 from dual; HOST EXP USERID=myusername/mypassFILE='^LOG1' GRANTS=Y ROWS=Y OWNER=SMPSYS LOG=EXPORT.LOG

We tried following code but it took backup of all tables. we need backup of selected tables. select 'C:\Daily-MIS-Backup\'||TO_CHAR(SYSDATE,'YYYYMMDD-HH24MISS')||'.DMP' foo3 from dual; HOST EXP USERID=myusername/mypassFILE='^LOG1' GRANTS=Y ROWS=Y OWNER=SMPSYS LOG=EXPORT.LOG

1

There are 1 best solutions below

0
Matthew McPeak On

The import and export utilities have a TABLES parameter. Syntax is like this:

 TABLES=(myschema1.table1, myschema2.table2, ...)

Remember to escape the parentheses if you're on UNIX or an OS that requires that.