数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

对Oracle10g ASM生产数据库备份和恢复


发布日期:2023年05月08日
 
对Oracle10g ASM生产数据库备份和恢复

新的g ASM生产数据库即将上线以下是上线前做的简单的备份恢复测试:

首先执行备份

$ rman target / @full_baksql

Recovery Manager: Release bit Production

Copyright (c) OracleAll rights reserved

connected to target database: MMSDB (DBID=)

RMAN> run {

> backup database plus archivelog delete all input;

> delete obsolete;

> }

>

Starting backup at APR

current log archived

using target database controlfile instead of recovery catalog

allocated channel: ORA_DISK_

channel ORA_DISK_: sid= devtype=DISK

channel ORA_DISK_: starting archive log backupset

channel ORA_DISK_: specifying archive log(s) in backup set

input archive log thread= sequence= recid= stamp=

channel ORA_DISK_: starting piece at APR

channel ORA_DISK_: finished piece at APR

piece handle=/msflsh/MMSDB/backupset/__/o_mf_annnn_TAGT_sry_bkp

comment=NONE

channel ORA_DISK_: backup set complete elapsed time: ::

channel ORA_DISK_: deleting archive log(s)

archive log filename=/msflsh/MMSDB/archivelog/__/o_mf___spg_arc recid=

stamp=

Finished backup at APR

Starting backup at APR

using channel ORA_DISK_

channel ORA_DISK_: starting full datafile backupset

channel ORA_DISK_: specifying datafile(s) in backupset

input datafile fno= name=+DATADG/mmsdb/datafile/system

input datafile fno= name=+DATADG/mmsdb/datafile/sysaux

input datafile fno= name=+DATADG/mmsdb/datafile/undotbs

input datafile fno= name=+DATADG/mmsdb/datafile/users

channel ORA_DISK_: starting piece at APR

channel ORA_DISK_: finished piece at APR

piece handle=/msflsh/MMSDB/backupset/__/o_mf_nnndf_TAGT_sthq_bkp

comment=NONE

channel ORA_DISK_: backup set complete elapsed time: ::

Finished backup at APR

Starting backup at APR

current log archived

using channel ORA_DISK_

channel ORA_DISK_: starting archive log backupset

channel ORA_DISK_: specifying archive log(s) in backup set

input archive log thread= sequence= recid= stamp=

channel ORA_DISK_: starting piece at APR

channel ORA_DISK_: finished piece at APR

piece handle=/msflsh/MMSDB/backupset/__/o_mf_annnn_TAGT_sbwm_bkp

comment=NONE

channel ORA_DISK_: backup set complete elapsed time: ::

channel ORA_DISK_: deleting archive log(s)

archive log filename=/msflsh/MMSDB/archivelog/__/o_mf___smj_arc recid=

stamp=

Finished backup at APR

Starting Control File and SPFILE Autobackup at APR

piece handle=/msflsh/MMSDB/autobackup/__/o_mf_s__sdf_bkp

comment=NONE

Finished Control File and SPFILE Autobackup at APR

RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy

using channel ORA_DISK_

no obsolete backups found

Recovery Manager complete

冻结HA停止数据库进行恢复

$ id

uid=(oracle) gid=(dba)

$ exit

# id

uid=(root) gid=(other)

# hagrp freeze MMSDB persistent

# su oracle

Sun Microsystems Inc SunOS Generic Patch October

You have new mail

$ id

uid=(oracle) gid=(dba)

$ sqlplus / as sysdba

SQL*Plus: Release Production on Wed Apr ::

Copyright (c) OracleAll rights reserved

Connected to:

Oracle Database g Enterprise Edition Release bit Production

With the Partitioning and Data Mining options

SQL> shutdown immediate;

Database closed

Database dismounted

ORACLE instance shut down

SQL> exit

Disconnected from Oracle Database g Enterprise Edition Release bit Production

With the Partitioning and Data Mining options

执行恢复

$ rman target /

Recovery Manager: Release bit Production

Copyright (c) OracleAll rights reserved

connected to target database (not started)

RMAN> startup mount;

Oracle instance started

database mounted

Total System Global Area bytes

Fixed Size bytes

Variable Size bytes

Database Buffers bytes

Redo Buffers bytes

RMAN> restore database;

Starting restore at APR

using target database controlfile instead of recovery catalog

allocated channel: ORA_DISK_

channel ORA_DISK_: sid= devtype=DISK

channel ORA_DISK_: starting datafile backupset restore

channel ORA_DISK_: specifying datafile(s) to restore from backup set

restoring datafile to +DATADG/mmsdb/datafile/system

restoring datafile to +DATADG/mmsdb/datafile/undotbs

restoring datafile to +DATADG/mmsdb/datafile/sysaux

restoring datafile to +DATADG/mmsdb/datafile/users

channel ORA_DISK_: restored backup piece

piece handle=/msflsh/MMSDB/backupset/__/o_mf_nnndf_TAGT_sthq_bkp

tag=TAGT

channel ORA_DISK_: restore complete

Finished restore at APR

RMAN> recover database;

Starting recover at APR

using channel ORA_DISK_

starting media recovery

media recovery complete

Finished recover at APR

RMAN> alter database open;

database opened

RMAN>

最后不要忘记解冻HA

$ exit

# id

uid=(root) gid=(other)

# hagrp unfreeze MMSDB persistent

测试过程仅供参考

上一篇:安装好Oracle后SQL*Plus的操作初步

下一篇:实用心得:虚拟机下Oracle的安装