(1)对数据库做完整备份,路径为/dm8/backup
开启数据库归档
$ mkdir -p /dm8/arch/DM01
$ chown dmdba:dinstall /dm8/arch /dm8/arch/DM01
$ disql SYSDBA/DM01SYSDBA:5236
数据库置为 mount
SQL> alter database mount;
SQL> select status$ from v$instance;
配置归档路径
SQL> alter database add archivelog 'DEST=/dm8/arch/DM01,TYPE=LOCAL,FILE_SIZE=64,SPACE_LIMIT=0';
SQL> select * from v$dm_arch_ini;
开启归档
SQL> alter database archivelog;
启动数据库
SQL> alter database open;
SQL> select status$ from v$instance;
SQL> select arch_mode from v¥database;
切换归档
SQL> alter system switch logfile;
SQL> select * from SYS.V$ARCH_FILE;
修改默认备份路径
$ mkdir -p /dm8/backup
$ chown dmdba:dinstall /dm8/backup
$ vi /dm8/data/DM01/dm.ini
BAK_PATH = /dm8/data/DM01/bak #backup file path
修改为
BAK_PATH = /dm8/backup #backup file path
$ cd /dm8/bin
$ ./DmServiceDMSVR01 restart
$ disql SYSDBA/DM01SYSDBA:5236
SQL> select * from SYS."V$PARAMETER" t where t.NAME = 'BAK_PATH';
在线全备数据库
$ disql SYSDBA/DM01SYSDBA:5236
SQL> backup database full to DM01_Full_BAK01 backupset '/dm8/backup';
检查:
$ find /dm8/backup
dmrman CTLSTMT="check backupset '/dm8/backup';"
(2)恢复备份,启动数据库实例
cat /opt/oper.sh
su - dmdba
/dm8/bin/DmServiceDMSVR01 stop
rm -rf /dm8/data/DM01/MAIN.DBF
恢复数据库:
/dm8/bin/dmrman
RESTORE DATABASE '/dm8/data/DM01/dm.ini' FROM BACKUPSET '/dm8/backup'
RECOVER DATABASE '/dm8/data/DM01/dm.ini' FROM BACKUPSET '/dm8/backup'
RECOVER DATABASE '/dm8/data/DM01/dm.ini' UPDATE DB_MAGIC
$ /dm8/bin/DmServiceDMSVR01 start
$ disql SYSDBA/DM01SYSDBA:5236
文章
阅读量
获赞