1. 重启单机DB
sqlplus '/ as sysdba'
SQL> startup mount;
2. 创建备份脚本
编辑备份脚本dbbkupfull.sh
#!/bin/bash
export ORACLE_HOME=/u01/sit/db/11.2.0
export ORACLE_SID=BZSIT
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
backtime=`date +"%y%m%d%H%M"`
$ORACLE_HOME/bin/rman target / log=dbfullbkup_$backtime.log <<EOF
run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
allocate channel c5 device type disk;
allocate channel c6 device type disk;
backup as compressed backupset full database format '/u01/dbbkup/b4imp/db_%d_%T_%U';
backup current controlfile format '/u01/dbbkup/b4imp/ctl_%d_%T_%s_%p.bak';
backup spfile format '/u01/dbbkup/b4imp/spfile_%d_%T_%s_%p.bak';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
release channel c6;
}
exit;
EOF
3. 运行备份
db1运行备份脚本
mkdir -p /u01/dbbkup/b4imp
nohup /bin/bash ~/dbbkupfull.sh 2>&1 &
监控脚本log以及/u01/dbbkup/b4imp下的备份文件。备份后关闭数据库
SQL> shutdown immediate;
#!/bin/bash
ORACLE_SID=BZCDB
ORACLE_HOME=/bzebs/sit/db/19.0.0
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
backtime=`date +"%y%m%d%H%M"`
$ORACLE_HOME/bin/rman target / log=dbfullbkup_$backtime.log <<EOF
run{
CONFIGURE DEVICE TYPE DISK PARALLELISM 16 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE CHANNEL DEVICE TYPE disk MAXPIECESIZE 8G;
backup as compressed backupset full database format '/bzsitdata/backup/db_%d_%T_%U';
backup current controlfile format '/bzsitdata/backup/ctl_%d_%T_%s_%p.bak';
backup spfile format '/bzsitdata/backup/spfile_%d_%T_%s_%p.bak';
}
exit;
EOF