0

0

【使用rman复制数据库10g--clone-1】

php中文网

php中文网

发布时间:2016-06-07 16:13:11

|

1097人浏览过

|

来源于php中文网

原创

目标数据库:jadl0g 复制的结果数据库:d10g 注意:****目标库与clone结果库在同一台机子上**** 1.vi /u01/oracle/10g/network/admin/tnsnames.ora D10G =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = oracle.db.com)(PORT = 1521))(CONNECT_DATA =(SE

目标数据库:jadl0g

复制的结果数据库:d10g

注意:****目标库与clone结果库在同一台机子上****

1.vi /u01/oracle/10g/network/admin/tnsnames.ora

D10G =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle.db.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = d10g)
)
(failover = on)
)

2.vi /u01/oracle/10g/network/admin/listener.ora

极限网络办公Office Automation
极限网络办公Office Automation

专为中小型企业定制的网络办公软件,富有竞争力的十大特性: 1、独创 web服务器、数据库和应用程序全部自动傻瓜安装,建立企业信息中枢 只需3分钟。 2、客户机无需安装专用软件,使用浏览器即可实现全球办公。 3、集成Internet邮件管理组件,提供web方式的远程邮件服务。 4、集成语音会议组件,节省长途话费开支。 5、集成手机短信组件,重要信息可直接发送到员工手机。 6、集成网络硬

下载
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME=jadl10g)
(SID_NAME = jadl10g)
(ORACLE_HOME = /u01/oracle/10g)
)
(SID_DESC =
(GLOBAL_DBNAME=d10g)
(SID_NAME = d10g)
(ORACLE_HOME = /u01/oracle/10g)
)
)

3.重启监听

lsnrctl stop
lsnrctl start
tnsping d10g
tnsping jadl10g

4.创建密码文件和参数文件

[oracle@oracle ~]$ cd /u01/oracle/10g/dbs/
[oracle@oracle dbs]$ orapwd file=orapwd10g password=oracle
[oracle@oracle dbs]$ strings spfilejadl10g.ora > initd10g.ora
[oracle@oracle dbs]$ vi initd10g.ora
:1,$ s/jadl10g/d10g/g---执行该命令

[oracle@oracle dbs]$ grep u01 initd10g.ora
*.audit_file_dest='/u01/oracle/admin/d10g/adump'
*.background_dump_dest='/u01/oracle/admin/d10g/bdump'
*.control_files='/u01/oracle/oradata/d10g/control01.ctl','/u01/oracle/flash_recovery_area/d10g/control02.ctl'#Restore Controlfile
*.core_dump_dest='/u01/oracle/admin/d10g/cdump'
*.db_recovery_file_dest='/u01/oracle/flash_recovery_area'
*.user_dump_dest='/u01/oracle/admin/d10g/udump'

5.创建相应的文件
[oracle@oracle dbs]$ mkdir /u01/oracle/admin/d10g/adump -p
[oracle@oracle dbs]$ mkdir /u01/oracle/admin/d10g/bdump -p
[oracle@oracle dbs]$ mkdir /u01/oracle/admin/d10g/cdump -p
[oracle@oracle dbs]$ mkdir /u01/oracle/admin/d10g/udump -p
[oracle@oracle dbs]$ mkdir /u01/oracle/oradata/d10g
[oracle@oracle dbs]$ export ORACLE_SID=d10g
[oracle@oracle dbs]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Fri Nov 7 12:59:20 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup nomount
Oracle instance started
Total System Global Area 599785472 bytes
Fixed Size 2098112 bytes
Variable Size 171969600 bytes
Database Buffers 419430400 bytes
Redo Buffers 6287360 bytes
RMAN> exit
Recovery Manager complete.
[oracle@oracle dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Fri Nov 7 13:00:15 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options

SQL> create spfile from pfile;
File created.

SQL> shutdown
ORA-01507: database not mounted
ORACLE instance shut down.


SQL> startup nomount
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2098112 bytes
Variable Size 171969600 bytes
Database Buffers 419430400 bytes
Redo Buffers 6287360 bytes
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options

****************************
[oracle@oracle dbs]$ rman target sys/oracle@jadl10g auxiliary sys/oracle@d10g
Recovery Manager: Release 10.2.0.5.0 - Production on Fri Nov 7 13:26:11 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-01031: insufficient privileges

这个错误是由于我的目标数据库没有密码文件造成的。
解决方法就是创建密码文件

[oracle@oracle dbs]$ orapwd file=orapwjadl10g password=oracle
****************************
[oracle@oracle dbs]$ rman target sys/oracle@jadl10g auxiliary sys/oracle@d10g
Recovery Manager: Release 10.2.0.5.0 - Production on Fri Nov 7 13:34:12 2014
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: JADL10G (DBID=2011530396)
connected to auxiliary database: D10G (not mounted)
执行如下命令(注意必须是远程和本地的顺序):
RMAN> duplicate target database to "D10G" nofilenamecheck
2> db_file_name_convert('/u01/oracle/oradata/jadl10g/','/u01/oracle/oradata/d10g/')
3> logfile '/u01/oracle/oradata/d10g/redo01.log' size 10m,
4> '/u01/oracle/oradata/d10g/redo02.log' size 10m;

Starting Duplicate Db at 07-NOV-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

contents of Memory Script:
{
set until scn 556591;
set newname for datafile 1 to
"/u01/oracle/oradata/d10g/system01.dbf";
set newname for datafile 2 to
"/u01/oracle/oradata/d10g/undotbs01.dbf";
set newname for datafile 3 to
"/u01/oracle/oradata/d10g/sysaux01.dbf";
set newname for datafile 4 to
"/u01/oracle/oradata/d10g/users01.dbf";
set newname for datafile 5 to
"/u01/oracle/oradata/d10g/example01.dbf";
restore
check readonly
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME

Starting restore at 07-NOV-14
using channel ORA_AUX_DISK_1

skipping datafile 1; alrea【本文来自鸿网互联 (http://www.68idc.cn)】dy restored to file /u01/oracle/oradata/d10g/system01.dbf
skipping datafile 2; already restored to file /u01/oracle/oradata/d10g/undotbs01.dbf
skipping datafile 3; already restored to file /u01/oracle/oradata/d10g/sysaux01.dbf
skipping datafile 4; already restored to file /u01/oracle/oradata/d10g/users01.dbf
skipping datafile 5; already restored to file /u01/oracle/oradata/d10g/example01.dbf
restore not done; all files readonly, offline, or already restored
Finished restore at 07-NOV-14
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "D10G" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/oracle/oradata/d10g/redo01.log' SIZE 10 M ,
GROUP 2 '/u01/oracle/oradata/d10g/redo02.log' SIZE 10 M
DATAFILE
'/u01/oracle/oradata/d10g/system01.dbf'
CHARACTER SET AL32UTF8

contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=863013896 filename=/u01/oracle/oradata/d10g/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=863013896 filename=/u01/oracle/oradata/d10g/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=863013896 filename=/u01/oracle/oradata/d10g/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=863013896 filename=/u01/oracle/oradata/d10g/example01.dbf

contents of Memory Script:
{
set until scn 556591;
recover
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 07-NOV-14
using channel ORA_AUX_DISK_1

starting media recovery

archive log thread 1 sequence 1 is already on disk as file /u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_1_b5qkpgh1_.arc
archive log thread 1 sequence 2 is already on disk as file /u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_2_b5qkpk0o_.arc
archive log thread 1 sequence 1 is already on disk as file /u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_1_b5rqvjwq_.arc
archive log thread 1 sequence 2 is already on disk as file /u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_2_b5rqvmxf_.arc
archive log filename=/u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_1_b5qkpgh1_.arc thread=1 sequence=1
archive log filename=/u01/oracle/flash_recovery_area/JADL10G/archivelog/2014_11_07/o1_mf_1_2_b5qkpk0o_.arc thread=1 sequence=2
media recovery complete, elapsed time: 00:00:23
Finished recover at 07-NOV-14

contents of Memory Script:
{
shutdown clone;
startup clone nomount ;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 599785472 bytes

Fixed Size 2098112 bytes
Variable Size 171969600 bytes
Database Buffers 419430400 bytes
Redo Buffers 6287360 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "D10G" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/oracle/oradata/d10g/redo01.log' SIZE 10 M ,
GROUP 2 '/u01/oracle/oradata/d10g/redo02.log' SIZE 10 M
DATAFILE
'/u01/oracle/oradata/d10g/system01.dbf'
CHARACTER SET AL32UTF8

contents of Memory Script:
{
set newname for tempfile 1 to
"/u01/oracle/oradata/d10g/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/oracle/oradata/d10g/undotbs01.dbf";
catalog clone datafilecopy "/u01/oracle/oradata/d10g/sysaux01.dbf";
catalog clone datafilecopy "/u01/oracle/oradata/d10g/users01.dbf";
catalog clone datafilecopy "/u01/oracle/oradata/d10g/example01.dbf";
switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed temporary file 1 to /u01/oracle/oradata/d10g/temp01.dbf in control file

cataloged datafile copy
datafile copy filename=/u01/oracle/oradata/d10g/undotbs01.dbf recid=1 stamp=863013929

cataloged datafile copy
datafile copy filename=/u01/oracle/oradata/d10g/sysaux01.dbf recid=2 stamp=863013929

cataloged datafile copy
datafile copy filename=/u01/oracle/oradata/d10g/users01.dbf recid=3 stamp=863013929

cataloged datafile copy
datafile copy filename=/u01/oracle/oradata/d10g/example01.dbf recid=4 stamp=863013929

datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=863013929 filename=/u01/oracle/oradata/d10g/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=863013929 filename=/u01/oracle/oradata/d10g/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=863013929 filename=/u01/oracle/oradata/d10g/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=863013929 filename=/u01/oracle/oradata/d10g/example01.dbf

contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 07-NOV-14
RMAN> exit
Recovery Manager complete.
验证是否clone成功:
[oracle@oracle dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Fri Nov 7 14:21:20 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining Scoring Engine
and Real Application Testing options

SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
d10g



1.密码文件问题
2.网络问题
3.参数问题
4.rman语句 db_file_name_convert 在同一个服务器设置语法有问题
5.注意必须要有备份,远程的话需要copy备份到目标库

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
Python 自然语言处理(NLP)基础与实战
Python 自然语言处理(NLP)基础与实战

本专题系统讲解 Python 在自然语言处理(NLP)领域的基础方法与实战应用,涵盖文本预处理(分词、去停用词)、词性标注、命名实体识别、关键词提取、情感分析,以及常用 NLP 库(NLTK、spaCy)的核心用法。通过真实文本案例,帮助学习者掌握 使用 Python 进行文本分析与语言数据处理的完整流程,适用于内容分析、舆情监测与智能文本应用场景。

10

2026.01.27

拼多多赚钱的5种方法 拼多多赚钱的5种方法
拼多多赚钱的5种方法 拼多多赚钱的5种方法

在拼多多上赚钱主要可以通过无货源模式一件代发、精细化运营特色店铺、参与官方高流量活动、利用拼团机制社交裂变,以及成为多多进宝推广员这5种方法实现。核心策略在于通过低成本、高效率的供应链管理与营销,利用平台社交电商红利实现盈利。

109

2026.01.26

edge浏览器怎样设置主页 edge浏览器自定义设置教程
edge浏览器怎样设置主页 edge浏览器自定义设置教程

在Edge浏览器中设置主页,请依次点击右上角“...”图标 > 设置 > 开始、主页和新建标签页。在“Microsoft Edge 启动时”选择“打开以下页面”,点击“添加新页面”并输入网址。若要使用主页按钮,需在“外观”设置中开启“显示主页按钮”并设定网址。

16

2026.01.26

苹果官方查询网站 苹果手机正品激活查询入口
苹果官方查询网站 苹果手机正品激活查询入口

苹果官方查询网站主要通过 checkcoverage.apple.com/cn/zh/ 进行,可用于查询序列号(SN)对应的保修状态、激活日期及技术支持服务。此外,查找丢失设备请使用 iCloud.com/find,购买信息与物流可访问 Apple (中国大陆) 订单状态页面。

136

2026.01.26

npd人格什么意思 npd人格有什么特征
npd人格什么意思 npd人格有什么特征

NPD(Narcissistic Personality Disorder)即自恋型人格障碍,是一种心理健康问题,特点是极度夸大自我重要性、需要过度赞美与关注,同时极度缺乏共情能力,背后常掩藏着低自尊和不安全感,影响人际关系、工作和生活,通常在青少年时期开始显现,需由专业人士诊断。

7

2026.01.26

windows安全中心怎么关闭 windows安全中心怎么执行操作
windows安全中心怎么关闭 windows安全中心怎么执行操作

关闭Windows安全中心(Windows Defender)可通过系统设置暂时关闭,或使用组策略/注册表永久关闭。最简单的方法是:进入设置 > 隐私和安全性 > Windows安全中心 > 病毒和威胁防护 > 管理设置,将实时保护等选项关闭。

6

2026.01.26

2026年春运抢票攻略大全 春运抢票攻略教你三招手【技巧】
2026年春运抢票攻略大全 春运抢票攻略教你三招手【技巧】

铁路12306提供起售时间查询、起售提醒、购票预填、候补购票及误购限时免费退票五项服务,并强调官方渠道唯一性与信息安全。

122

2026.01.26

个人所得税税率表2026 个人所得税率最新税率表
个人所得税税率表2026 个人所得税率最新税率表

以工资薪金所得为例,应纳税额 = 应纳税所得额 × 税率 - 速算扣除数。应纳税所得额 = 月度收入 - 5000 元 - 专项扣除 - 专项附加扣除 - 依法确定的其他扣除。假设某员工月工资 10000 元,专项扣除 1000 元,专项附加扣除 2000 元,当月应纳税所得额为 10000 - 5000 - 1000 - 2000 = 2000 元,对应税率为 3%,速算扣除数为 0,则当月应纳税额为 2000×3% = 60 元。

35

2026.01.26

oppo云服务官网登录入口 oppo云服务登录手机版
oppo云服务官网登录入口 oppo云服务登录手机版

oppo云服务https://cloud.oppo.com/可以在云端安全存储您的照片、视频、联系人、便签等重要数据。当您的手机数据意外丢失或者需要更换手机时,可以随时将这些存储在云端的数据快速恢复到手机中。

121

2026.01.26

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Node.js 教程
Node.js 教程

共57课时 | 9.5万人学习

CSS3 教程
CSS3 教程

共18课时 | 4.9万人学习

Git 教程
Git 教程

共21课时 | 3万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号