如下Linux环境下对Oracle单节点数据库采用文件系统情况的配置归档模式过程。首先查看数据库归档模式和磁盘使用情况,确定归档文件放到什么位置:
- [oracle@gisdbserver~]$sqlplus/assysdba
- sql>archiveloglist
- DatabaselogmodeNoArchiveMode
- AutomaticarchivalDisabled
- Archivedestination/dbback/archivelog
- Oldestonlinelogsequence92
- Currentlogsequence97
根据如下磁盘使用情况,在相应的目录下建立相关归档和备份目录:
[root@gisdbserver~]#df-h
FilesystemSizeUsedAvailUse%Mountedon
/dev/mapper/vg_gisdbserver-lv_root99G3.8G90G4%/
tmpfs16G76K16G1%/dev/shm
/dev/sda2485M39M421M9%/boot
/dev/sda1200M260K200M1%/boot/efi
/dev/mapper/vg_gisdbserver-LogVol03481G198M457G1%/dbback
/dev/mapper/vg_gisdbserver-LogVol04407G9.3G377G3%/home
/dev/mapper/vg_gisdbserver-LogVol0299G4.5G89G5%/opt
dev/sdb441G72G347G18%/oradata
创建相关归档日志存放目录:
[root@gisdbserver~]#cd/dbback/
[root@gisdbserverdbback]#mkdirarchivelog
[root@gisdbserverdbback]#chown-Roracle:oinstallarchivelog/
[root@gisdbserverdbback]#mkdirrman
[root@gisdbserverdbback]#chownoracle:oinstallrman/
[root@gisdbserverrman]#mkdirfullback
[root@gisdbserverrman]#mkdirarchiveback
[root@gisdbserverrman]#chownoracle:oinstallarchiveback/
[root@gisdbserverrman]#chownoracle:oinstallfullback/
登录数据库指定归档存放目录:
assysdba
sql>altersystemsetlog_archive_dest_1='location=/dbback/archivelog';
Systemaltered.
sql>showparameterlog_archive_dest_1
NAMETYPEVALUE
log_archive_dest_1stringlocation=/dbback/archivelog
要将非归档数据库模式改为归档模式,需要在mount状态下执行alter database archivelog命令才行,如下:
sql>archiveloglist
NoArchiveMode
AutomaticarchivalDisabled
Archivedestination/dbback/archivelog
Oldestonlinelogsequence92
sequence97
sql>alterdatabasearchivelog;
databasearchivelog
*
ERRORatline1:
ORA-01126:databasemustbemountedinthisinstanceandnotopeninany
instance
因此需要在合适的时间关闭数据库,重新启动到mount状态下才能改变为归档模式。
sql>shutdownimmediate;
sql>startupmount;
sql>databasearchivelog;
要开启rman备份,需要对配置rman相关的一些参数,具体如下:
oracle@gisdbserver~]$rmantarget/
RMAN>backupDATABASEincludeCURRENTcontrolfileformat'/dbback/rman/fullback/data_%d_%T_%s_%p'plusarchivelogformat'+/dbback/rman/archiveback/arch_%d_%T_%s';
以上语句也可以通过linux的crontab 和 bash脚本方式进行自动化运行。
run{
DELETENOPROMPTexpiredarchivelogALL;
allocatechanneld1TYPEdiskmaxpiecesize=30G;
allocatechanneld2TYPEdiskmaxpiecesize=30G;
backupCURRENTcontrolfileformat'/dbback/rman/fullback/data_%d_%T_%s_%p'plusarchivelogformat'+/dbback/rman/archiveback/arch_%d_%T_%s';
releasechanneld1;
releasechanneld2;
crosscheckbackup;
DELETEnopromptobsoleteREDUNDANCY1;
}
【编辑推荐】
原文链接:/oracle/206882.html