Oracle SQL Developer 一步一步复制数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13272225/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 12:00:05  来源:igfitidea点击:

Oracle SQL Developer copy database step by step

sqldatabaseoracleoracle-sqldeveloperdatabase-administration

提问by SonOfGrey

I'm having big trouble in copying an Oracle DB to the same server but with another name, to use as a development DB.

我在将 Oracle DB 复制到同一台服务器但使用另一个名称以用作开发 DB 时遇到了大麻烦。

I'm used to SQL Server, I'm new to Oracle (11g).

我习惯了 SQL Server,我是 Oracle (11g) 的新手。

I wanted to use the 'Database copy' from SQL Developer, but I'm getting errors all the way. First it was about missing tablespaces. Then when I manually created them in my new empty DB the errors were about missing users. I wanted to create the users manually, but then I first needed to create missing roles. When all that was done, it failed on missing indexes...

我想使用 SQL Developer 的“数据库副本”,但一直出现错误。首先是关于缺少表空间。然后当我在我的新空数据库中手动创建它们时,错误是关于缺少用户。我想手动创建用户,但是我首先需要创建缺少的角色。当所有这些都完成后,它在缺少索引时失败了......

How do I copy everything I need with 'Database copy'?

如何使用“数据库副本”复制我需要的所有内容?

Any advice is greatly appreciated!

任何意见是极大的赞赏!

采纳答案by Colin 't Hart

SQL Developer copy will only copy objects between schemas. Do you want to just make a copy of a schema? Or a whole new database, including all schemas?

SQL Developer 副本只会在模式之间复制对象。您只想制作模式的副本吗?还是一个全新的数据库,包括所有模式

Judging by your question, I'm assuming the latter. If so, RMAN "database duplication" may help you.

从你的问题来看,我假设是后者。如果是这样,RMAN 的“数据库复制”可能会对您有所帮助。

See http://www.oracle-base.com/articles/11g/duplicate-database-using-rman-11gr2.phpat Tim Hall's excellent site.

请参阅Tim Hall 优秀站点上的http://www.oracle-base.com/articles/11g/duplicate-database-using-rman-11gr2.php

回答by Battail

The best way for you is to create a new user :

Launch MSDOS Shell Connect to your database using system manager account sqlplus / as sysdba

Then write these sequences:

CREATE USER user2 IDENTIFIED BY user2password;

GRANT ALL PRIVILEGE TO user2 WITH ADMIN OPTION;

GRANT CONNECT TO user2;

GRANT DBA TO user2;

exit oracle prompt

In MSDOS Shell again, export your current user1 like this :

exp user1/password

or exp user1/password@connectString

if you have a connection string specified in tnsnames.ora Answer all the questions by default, give a name to your export file, and specify that you want to export only the user user1

Then proceed to the importation of the dump in your new user2 like this :

imp user2/password2 fromuser=user1 touser=user2

Answer all the questions by default, give the name to your export file (if you don't change the default folder of CmdShell you will not have to specify the complete folder)

对您来说最好的方法是创建一个新用户:

启动 MSDOS Shell 使用系统管理员帐户 sqlplus / as sysdba 连接到您的数据库

然后写这些序列:

CREATE USER user2 IDENTIFIED BY user2password;

使用管理员选项将所有权限授予 user2;

授予与用户 2 的连接;

将 DBA 授予 user2;

退出 oracle 提示

再次在 MSDOS Shell 中,像这样导出当前的 user1:

exp 用户 1/密码

或 exp user1/password@connectString

如果您在 tnsnames.ora 中指定了连接字符串默认回答所有问题,为您的导出文件命名,并指定您只想导出用户 user1

然后继续在您的新 user2 中导入转储,如下所示:

imp user2/password2 fromuser=user1 touser=user2

默认回答所有问题,为导出文件命名(如果不更改 CmdShell 的默认文件夹,则不必指定完整文件夹)

回答by Alfonso Leon