How can I create backup script for selected tables in Oracle

huangapple go评论65阅读模式
英文:

How can I create backup script for selected tables in Oracle

问题

我正在使用以下脚本来创建备份文件,但它备份了所有表格。我想要备份选定的表格。如何实现这一目标。

以下脚本运行正常。

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

我们尝试了以下代码,但它备份了所有表格。我们需要备份选定的表格。

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
英文:

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

得分: 2

importexport 工具有一个 TABLES 参数。语法如下:

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

如果你在 UNIX 或需要转义括号的操作系统上使用,请记得转义括号。

英文:

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.

huangapple
  • 本文由 发表于 2023年7月17日 21:34:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76705004.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定