Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

0

积分

1

好友

4

主题
1#
发表于 2013-5-29 16:58:58 | 查看: 4808| 回复: 19
首先非常感谢刘大制作的视频,让我这个PAPER OCP顺利在虚拟机上搭建出了RAC,现在又照着刘大的视频自己打DG ,与视频里环境唯一不同的是没有用ASM 就用了普通的文件系统,也没有创建GRID用户,lisnten和tns都是在oracle的/network/admin下改的最后在做到duplicate target database 时报错了。


RMAN> duplicate target database
2> for standby
3> from active database
4> DORECOVER
5> spfile
6> set db_unique_name='MACDBS'
7> set log_archive_dest_1='location=/s01/fast_recovery_area/MACDBS/archivelog  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MACDBS'
8> set log_archive_dest_2='SERVICE=MACDBN ASYNC LGWR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MACDBN'
9> set standby_file_management='AUTO'
10> set fal_server='MACDBN'
11> set fal_client='MACDBS'
12> set control_files='/s01/oradata/MACDBS/control01.ctl','/s01/fast_recovery_area/MACDBS/control02.ctl'
13> set memory_target='0'
14> set sga_target='600M';
15>
Starting Duplicate Db at 29-MAY-13
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwMACDBN' auxiliary format
'/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwMACDBS'   targetfile
'/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMACDBN.ora' auxiliary format
'/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMACDBS.ora'   ;
   sql clone "alter system set spfile= ''/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMACDBS.ora''";
}
executing Memory Script

Starting backup at 29-MAY-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=31 device type=DISK
Finished backup at 29-MAY-13

sql statement: alter system set spfile= ''/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMACDBS.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_unique_name =
''MACDBS'' comment=
'''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 =
''location=/s01/fast_recovery_area/MACDBS/archivelog  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MACDBS'' comment=
'''' scope=spfile";
   sql clone "alter system set  log_archive_dest_2 =
''SERVICE=MACDBN ASYNC LGWR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MACDBN'' comment=
'''' scope=spfile";
   sql clone "alter system set  standby_file_management =
''AUTO'' comment=
'''' scope=spfile";
   sql clone "alter system set  fal_server =
''MACDBN'' comment=
'''' scope=spfile";
   sql clone "alter system set  fal_client =
''MACDBS'' comment=
'''' scope=spfile";
   sql clone "alter system set  control_files =
''/s01/oradata/MACDBS/control01.ctl'', ''/s01/fast_recovery_area/MACDBS/control02.ctl'' comment=
'''' scope=spfile";
   sql clone "alter system set  memory_target =
0 comment=
'''' scope=spfile";
   sql clone "alter system set  sga_target =
600M comment=
'''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_unique_name =  ''MACDBS'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_1 =  ''location=/s01/fast_recovery_area/MACDBS/archivelog  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MACDBS'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_2 =  ''SERVICE=MACDBN ASYNC LGWR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MACDBN'' comment= '''' scope=spfile

sql statement: alter system set  standby_file_management =  ''AUTO'' comment= '''' scope=spfile

sql statement: alter system set  fal_server =  ''MACDBN'' comment= '''' scope=spfile

sql statement: alter system set  fal_client =  ''MACDBS'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/s01/oradata/MACDBS/control01.ctl'', ''/s01/fast_recovery_area/MACDBS/control02.ctl'' comment= '''' scope=spfile

sql statement: alter system set  memory_target =  0 comment= '''' scope=spfile

sql statement: alter system set  sga_target =  600M comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/29/2013 10:03:16
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-04014: startup failed: ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9925

Recovery Manager complete.



以上文件路径都是存在的,请教大神们如何改正。
2#
发表于 2013-5-29 19:45:50
Unable to create audit trail file

明确漏步骤

回复 只看该作者 道具 举报

3#
发表于 2013-5-30 13:59:19
刘大我已按照您的视频和文档又做了遍,还是出现RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/29/2013 10:03:16
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-04014: startup failed: ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9925
有一点不明白为什么备库的参数文件里是db_name=MACDB 而不是MACDBS
mkdir -p /s01/admin/MACDB/adump
mkdir -p /s01/admin/MACDBS/adump
这2步也都做了,ORA-09925: Unable to create audit trail file 这个错误可能是哪里做的不对呢?

回复 只看该作者 道具 举报

4#
发表于 2013-5-30 14:32:42
1、检查目录权限
2、核对spfile中目录参数

回复 只看该作者 道具 举报

5#
发表于 2013-5-30 15:50:27
贴一下你的parameter file参数吧

回复 只看该作者 道具 举报

6#
发表于 2013-5-30 18:40:52
主库 MACDBN 的PFILE


[oracle@mlab1 dbs]$ vim initMACDBN.ora
MACDBN.__db_cache_size=104857600
MACDBN.__java_pool_size=4194304
MACDBN.__large_pool_size=4194304
MACDBN.__oracle_base='/s01'#ORACLE_BASE set from environment
MACDBN.__pga_aggregate_target=167772160
MACDBN.__sga_target=247463936
MACDBN.__shared_io_pool_size=0
MACDBN.__shared_pool_size=121634816
MACDBN.__streams_pool_size=4194304
*.audit_file_dest='/s01/admin/MACDBN/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/s01/oradata/MACDBN/control01.ctl','/s01/fast_recovery_area/MACDBN/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='MACDB'
*.db_recovery_file_dest='/s01/fast_recovery_area'
*.db_recovery_file_dest_size=4322230272
*.db_unique_name='MACDBN'
*.diagnostic_dest='/s01'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=MACDBNXDB)'
*.fal_client='MACDBN'
*.fal_server='MACDBS'
*.log_archive_config='DG_CONFIG=(MACDBN,MACDBS)'
*.log_archive_dest_1='LOCATION=/s01/fast_recovery_area/MACDBN/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MACDBN'
*.log_archive_dest_2='SERVICE=MACDBS ASYNC LGWR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MACDBS'
*.log_archive_format='arch_%r_%t_%s.arc'
*.memory_target=415236096
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
~

下面是duplicate的参数

duplicate target database

for standby

from active database

DORECOVER

spfile

set db_unique_name='MACDBS'

set log_archive_dest_1='location=/s01/fast_recovery_area/MACDBS/archivelog  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MACDBS'

set log_archive_dest_2='SERVICE=MACDBN ASYNC LGWR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MACDBN'

set standby_file_management='AUTO'

set fal_server='MACDBN'

set fal_client='MACDBS'

set control_files='/s01/oradata/MACDBS/control01.ctl','/s01/fast_recovery_area/MACDBS/control02.ctl'

set memory_target='0'

set sga_target='600M';

回复 只看该作者 道具 举报

7#
发表于 2013-5-30 19:15:52
*.audit_file_dest='/s01/admin/MACDBN/adump'

vs

mkdir -p /s01/admin/MACDB/adump
mkdir -p /s01/admin/MACDBS/adump

回复 只看该作者 道具 举报

8#
发表于 2013-5-30 19:15:57
*.audit_file_dest='/s01/admin/MACDBN/adump'

vs

mkdir -p /s01/admin/MACDB/adump
mkdir -p /s01/admin/MACDBS/adump

回复 只看该作者 道具 举报

9#
发表于 2013-5-30 19:39:10
刘大
mkdir -p /s01/admin/MACDB/adump
mkdir -p /s01/admin/MACDBS/adump

这2个路径我是在备库里创建好了再在主库那duplicate  出错的

回复 只看该作者 道具 举报

10#
发表于 2013-5-30 20:11:46
本帖最后由 shj198746 于 2013-5-30 20:13 编辑

QQ截图20130530200944.jpg

回复 只看该作者 道具 举报

11#
发表于 2013-5-30 20:13:59
截图在附件

QQ截图20130530200944.jpg (77.12 KB, 下载次数: 351)

QQ截图20130530200944.jpg

回复 只看该作者 道具 举报

12#
发表于 2013-5-31 09:07:52
8楼已经给你提示了

回复 只看该作者 道具 举报

13#
发表于 2013-5-31 18:43:30
刘大 你意思是在主库pfile里把 *.audit_file_dest='/s01/admin/MACDBN/adump' 改成
*.audit_file_dest='/s01/admin/MACDBS/adump'
然后备库 mkdir -p /s01/admin/MACDBS/adump
就可以了吗?
小弟刚接触oracle半年,请明示,O(∩_∩)O谢谢

回复 只看该作者 道具 举报

14#
发表于 2013-6-3 14:43:15
修改audit_trail='none'

回复 只看该作者 道具 举报

15#
发表于 2013-6-3 20:09:07
参数怎么设 目录怎么建 ,  一一对应  这有难度吗?

回复 只看该作者 道具 举报

16#
发表于 2013-6-5 13:22:39
我再试试看....

回复 只看该作者 道具 举报

17#
发表于 2013-6-6 23:17:10
错误很明显啊
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 2: No such file or directory
你的文件目录怎么建的 你cd 到那个目录 然后 pwd一下
参数文件设置成那个路径就好了

回复 只看该作者 道具 举报

18#
发表于 2013-6-10 19:02:15
抽空又重新做了次 还是在rman target / auxiliary sys/a@MACDBS这里出错 这次的报错就看不懂了....

[oracle@mlab1 ~]$ rman target / auxiliary sys/a@MACDBS cmdfile=duplicate_mac.sql

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jun 10 18:54:21 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: MACDBN (DBID=4029287812)
connected to auxiliary database: MACDB (not mounted)

RMAN>
RMAN>
RMAN>
RMAN> duplicate target database
2> for standby
3> from active database
4> DORECOVER
5> spfile
6> set db_unique_name='MACDBS'
7> set log_archive_dest_1='location=/s01/flash_recovery_area/MACDBN/archivelog/  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MACDBS'
8> set log_archive_dest_2='SERVICE=MACDBN  ASYNC  LGWR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MACDBN'
9> set standby_file_management='AUTO'
10> set fal_server='MACDBN'
11> set fal_client='MACDBS'
12> set control_files='/s01/oradata/MACDBN/control01.ctl'
13> set memory_target='0'
14> set sga_target='400M';
15>
Starting Duplicate Db at 10-JUN-13
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwMACDBN' auxiliary format
'/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwMACDBS'   targetfile
'/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMACDBN.ora' auxiliary format
'/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMACDBS.ora'   ;
   sql clone "alter system set spfile= ''/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMACDBS.ora''";
}
executing Memory Script

Starting backup at 10-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK
Finished backup at 10-JUN-13

sql statement: alter system set spfile= ''/s01/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMACDBS.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_unique_name =
''MACDBS'' comment=
'''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 =
''location=/s01/flash_recovery_area/MACDBN/archivelog/  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MACDBS'' comment=
'''' scope=spfile";
   sql clone "alter system set  log_archive_dest_2 =
''SERVICE=MACDBN  ASYNC  LGWR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MACDBN'' comment=
'''' scope=spfile";
   sql clone "alter system set  standby_file_management =
''AUTO'' comment=
'''' scope=spfile";
   sql clone "alter system set  fal_server =
''MACDBN'' comment=
'''' scope=spfile";
   sql clone "alter system set  fal_client =
''MACDBS'' comment=
'''' scope=spfile";
   sql clone "alter system set  control_files =
''/s01/oradata/MACDBN/control01.ctl'' comment=
'''' scope=spfile";
   sql clone "alter system set  memory_target =
0 comment=
'''' scope=spfile";
   sql clone "alter system set  sga_target =
400M comment=
'''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_unique_name =  ''MACDBS'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_1 =  ''location=/s01/flash_recovery_area/MACDBN/archivelog/  VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MACDBS'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_2 =  ''SERVICE=MACDBN  ASYNC  LGWR VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MACDBN'' comment= '''' scope=spfile

sql statement: alter system set  standby_file_management =  ''AUTO'' comment= '''' scope=spfile

sql statement: alter system set  fal_server =  ''MACDBN'' comment= '''' scope=spfile

sql statement: alter system set  fal_client =  ''MACDBS'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/s01/oradata/MACDBN/control01.ctl'' comment= '''' scope=spfile

sql statement: alter system set  memory_target =  0 comment= '''' scope=spfile

sql statement: alter system set  sga_target =  400M comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     418484224 bytes

Fixed Size                     1336932 bytes
Variable Size                134220188 bytes
Database Buffers             276824064 bytes
Redo Buffers                   6103040 bytes

contents of Memory Script:
{
   backup as copy current controlfile for standby auxiliary format  '/s01/oradata/MACDBN/control01.ctl';
}
executing Memory Script

Starting backup at 10-JUN-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 06/10/2013 18:54:51
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/10/2013 18:54:51
ORA-17628: Oracle error 19505 returned by remote Oracle server

Recovery Manager complete.

回复 只看该作者 道具 举报

19#
发表于 2013-6-10 19:04:28
主库的控制文件路径也没错

SQL> show parameter control

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      /s01/oradata/MACDBN/control01.ctl

control_management_pack_access       string      DIAGNOSTIC+TUNING

回复 只看该作者 道具 举报

20#
发表于 2013-6-19 21:37:28
学习了解

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-11-16 15:30 , Processed in 0.060114 second(s), 24 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569