在没有数据的情况下克隆 oracle 数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3413096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
clone oracle database without data
提问by haluk
I want to clone my existing oracle database structure without data including packages, users, tablespaces etc. I read some methods but they all copied data as well. Is there anyway out in order to do this?
我想克隆我现有的 oracle 数据库结构,而不包含包、用户、表空间等数据。我阅读了一些方法,但它们也都复制了数据。有没有办法做到这一点?
Thanks in advance.
提前致谢。
回答by Janek Bogucki
回答by ThinkJet
Use Oracle exp.exe utility for export. E.g.
使用 Oracle exp.exe 实用程序进行导出。例如
EXP.EXE login/password@TNSNAME file=entire_db.dmp owner=(scott, my_user, user2) rows=n grants=y triggers=y
Only rows=n option in command above make sense for your task.
只有上面命令中的 rows=n 选项对您的任务有意义。
You can import to target database with imp.exe
utility.
您可以使用imp.exe
实用程序导入到目标数据库。
Look for detailed option list and definition by running this utilities with help=y
option.
通过使用help=y
选项运行此实用程序来查找详细的选项列表和定义。
BUTtablespaces and users on target databases must be created manually before running import. There are no standard tablespace cloning tools (including SQL Developer), but some queries exists for generating such cloning scripts. Examples can be found hereand here.
但是必须在运行导入之前手动创建目标数据库上的表空间和用户。没有标准的表空间克隆工具(包括 SQL Developer),但存在一些用于生成此类克隆脚本的查询。可以在此处和此处找到示例。
P.S. This question better fits to ServerFaultthan to StackOverflow ...
PS 这个问题更适合ServerFault 而不是 StackOverflow ...
回答by Rakesh Goyal
You can do it in toad but its not free tool. (Database Tab->Export->Export DDL)
您可以在 toad 中执行此操作,但它不是免费工具。(数据库选项卡->导出->导出 DDL)
回答by Rakesh Goyal
Try Oracle Export command with ROWS=N
尝试使用 ROWS=N 的 Oracle 导出命令
exp SCOTT/TIGER ROWS=N TRIGGERS=N
回答by kernowcode
Use SQL Developer, Tools > Database Export.
使用 SQL Developer,工具 > 数据库导出。
You will need to specify at least one table in the 'data' option because you cannot choose to NOT export any data. Pick a table that has a small number of rows or create a dummy table without any rows beforehand as a workaround.
您需要在“数据”选项中至少指定一个表,因为您不能选择不导出任何数据。选择一个行数较少的表,或者预先创建一个没有任何行的虚拟表作为解决方法。