欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

RMAN异机恢复步骤及故障处理

程序员文章站 2022-06-16 19:31:06
...

一、测试机安装OS+Oracle Software,包括配置oracle用户、组和环境变量(略) 二、开始异机恢复 1. 复制源库最新备份集、初始

RMAN异机恢复步骤及故障处理

[日期:2014-10-20] 来源:Linux社区 作者:aaron8219 [字体:]

一、测试机安装OS+Oracle Software,包括配置oracle用户、组和环境变量(略)

二、开始异机恢复

1. 复制源库最新备份集、初始化参数、密码文件到测试机

[oracle@ora10g backupsets]$ scp *20141012* 192.168.1.213:/tmp

The authenticity of host '192.168.1.213 (192.168.1.213)' can't be established.

RSA key fingerprint is 78:0e:33:cb:3f:04:e4:5d:d1:71:29:a4:3f:3a:79:41.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.1.213' (RSA) to the list of known hosts.

oracle@192.168.1.213's password:

Connection closed by 192.168.1.213

lost connection

[oracle@ora10g backupsets]$ scp *20141012* 192.168.1.213:/tmp

oracle@192.168.1.213's password:

ora10g-4175411955_20141012_860776699_315.arc 100% 4336KB 2.1MB/s 00:02

ora10g-4175411955_20141012_860776704_316.db 100% 165MB 2.1MB/s 01:20

ora10g-4175411955_20141012_860776830_317.arc 100% 418KB 417.5KB/s 00:00

ora10g-c-4175411955-20141012-00.ctl 100% 7424KB 2.4MB/s 00:03

[oracle@ora10g backupsets]$ scp $ORACLE_HOME/dbs/initora10g.ora oracle@192.168.1.213:/tmp

oracle@192.168.1.213's password:

initora10g.ora 100% 1136 1.1KB/s 00:00

[oracle@ora10g backupsets]$ scp $ORACLE_HOME/dbs/orapwora10g oracle@192.168.1.213:/tmp

oracle@192.168.1.213's password:

orapwora10g 100% 1536 1.5KB/s 00:00

如果没有生成过initora10g.ora初始化参数文件,则创建一个:

SQL> create pfile from spfile;

创建完默认路径是放在$ORACLE_HOME/dbs下面

2. 修改初始化参数

[root@bak tmp]# cat initora10g.ora

ora10g.__db_cache_size=0

ora10g.__java_pool_size=0

ora10g.__large_pool_size=0

ora10g.__shared_pool_size=0

ora10g.__streams_pool_size=0

*.audit_file_dest='/oracle/admin/ora10g/adump'

*.background_dump_dest='/oracle/admin/ora10g/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/oradata/ora10g/control01.ctl','/oradata/ora10g/control02.ctl','/oradata/ora10g/control03.ctl'#Restore Controlfile

*.core_dump_dest='/oracle/admin/ora10g/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='ora10g'

*.db_recovery_file_dest='/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.dispatchers='(PROTOCOL=TCP) (SERVICE=ora10gXDB)'

*.job_queue_processes=10

*.log_archive_format='%t_%s_%r.dbf'

*.nls_language='SIMPLIFIED CHINESE'

*.nls_territory='CHINA'

*.open_cursors=300

*.pga_aggregate_target=0

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=0

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/oracle/admin/ora10g/udump'

注意,假设我这里测试机使用的目录和源库不同,注意红色部分为修改的内容

3. 把密码文件和修改好的初始化参数文件拷贝到测试机相应位置

[oracle@bak ~]$ mv /tmp/initora10g.ora $ORACLE_HOME/dbs

[oracle@bak ~]$ mv /tmp/orapwora10g $ORACLE_HOME/dbs

--------------------------------------推荐阅读 --------------------------------------

RMAN 配置归档日志删除策略

Oracle基础教程之通过RMAN复制数据库

RMAN备份策略制定参考内容

RMAN备份学习笔记

Oracle数据库备份加密 RMAN加密

--------------------------------------分割线 --------------------------------------

4. 在测试机根据初始化参数文件中指定的路径创建目录(注意目录必须对于oracle用户有读写权限)

[root@bak tmp]# mkdir /oradata/ora10g -p

[root@bak tmp]# mkdir /oracle/admin/ora10g/adump -p

[root@bak tmp]# mkdir /oracle/admin/ora10g/bdump

[root@bak tmp]# mkdir /oracle/admin/ora10g/cdump

[root@bak tmp]# mkdir /oracle/admin/ora10g/udump

[root@bak tmp]# chown oracle:oinstall /oradata -R

[root@bak tmp]# chmod 755 /oradata -R

[root@bak tmp]# chown oracle:oinstall /oracle -R

[root@bak tmp]# chmod 755 /oracle -R

5. 启动实例到nomount

SQL> startup nomount

ORA-00371: not enough shared pool memory, should be atleast 72265318 bytes

由于假设测试机配置要比源库低,,而暂时不确定如何分配SGA,刚才在初始化参数中把内存分配的值,都设置成了0,包括sga_target,既然没有自动分配内存组件,那么手动设置sga_target=1G

SQL> !

[oracle@bak ~]$ vim /u01/app/oracle/product/10.2.0/db_1/dbs/initora10g.ora

...

*.sga_target=1G

...

修改保存后,重新启动实例

[oracle@bak ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Oct 12 17:25:50 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount

ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated

ORA-01262: Stat failed on a file destination directory

Linux Error: 2: No such file or directory

由于刚才忘记创建了/oracle/flash_recovery_area这个目录,因此报错,如果测试机并不想启用FRA的话,可以把该参数注释掉

SQL> !

[oracle@bak ~]$ vim /u01/app/oracle/product/10.2.0/db_1/dbs/initora10g.ora

...

#*.db_recovery_file_dest='/oracle/flash_recovery_area'

#*.db_recovery_file_dest_size=2147483648

...

[oracle@bak ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Oct 12 17:28:08 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 1073741824 bytes

Fixed Size 1223512 bytes

Variable Size 264242344 bytes

Database Buffers 805306368 bytes

Redo Buffers 2969600 bytes

SQL>

注意,如果登陆SQLPLUS时碰到无法用OS Local验证,只需用netca创建一个监听即可解决

6. 恢复测试机控制文件

[oracle@bak ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Sun Oct 12 17:42:07 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: ora10g (not mounted)

RMAN> restore controlfile from '/tmp/ora10g-c-4175411955-20141012-00.ctl';

Starting restore at 12-OCT-14

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:05

output filename=/oradata/ora10g/control01.ctl

output filename=/oradata/ora10g/control02.ctl

output filename=/oradata/ora10g/control03.ctl

Finished restore at 12-OCT-14

RMAN> alter database mount;

database mounted

released channel: ORA_DISK_1

在CentOS 6.4下安装Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虚拟机中安装步骤

Debian 下 安装 Oracle 11g XE R2

更多详情见请继续阅读下一页的精彩内容:

RMAN异机恢复步骤及故障处理

  • 0
  • Install Orace 11g on Solaris 10 Sparc 64 bit

    使用rowid和rownum获取记录时要注意的问题