12C安装结束需要做的一些操作


修改spfile参数:
修改前,先备份

create pfile from spfile;


alter system set memory_target=0 scope=spfile;
alter system set sga_max_size=1g scope=spfile;
alter system set sga_target=1g scope=spfile;
alter system set pga_aggregate_target=1g scope=spfile;
alter system set processes=6000 scope=spfile;
alter system set DB_FILES=2000 scope=spfile;

alter system set log_archive_max_processes=2 scope=spfile;
alter system set nls_date_format='YYYY-MM-DD HH24:MI:SS' scope=spfile;
alter system set open_cursors=3000 scope=spfile;
alter system set open_links_per_instance=48 scope=spfile;
alter system set open_links=100 scope=spfile;
alter system set parallel_max_servers=20 scope=spfile;
alter system set session_cached_cursors=200 scope=spfile;
alter system set undo_retention=10800 scope=spfile;
alter system set fast_start_mttr_target=300 scope=spfile;
alter system set deferred_segment_creation=false scope=spfile;
alter system set "_external_scn_logging_threshold_seconds"=600 scope=spfile;
alter system set "_external_scn_rejection_threshold_hours"=24 scope=spfile;
alter system set result_cache_max_size=0 scope=spfile;
alter system set "_cleanup_rollback_entries"=2000 scope=spfile;
alter system set parallel_force_local=true scope=spfile;
alter system set "_gc_policy_time"=0 scope=spfile;
alter system set "_clusterwide_global_transactions"=false scope=spfile;
alter system set "_library_cache_advice"=false scope=both;
alter system set db_cache_advice=off scope=both;
alter system set disk_asynch_io=false scope=spfile;


开启归档模式

创建归档文件目录:
mkdir /home/arch
chown oracle:dba /home/arch

alter system set log_archive_format='%d_%t_%s_%r.arc' scope=spfile;
alter system set log_archive_dest_1='location=/home/arch';

SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;


验证是否处于归档模式:
archive log list;
alter system archive log current;

查看操作系统是否有文件生成:
[oracle@hdentdb7 dbs]$ ls -l /home/arch
total 166300
-rw-r----- 1 oracle oinstall 170291200 May 25 19:59 1_1_977070699.arc

扫描二维码关注公众号,回复: 1030643 查看本文章


改变控制文件备份路径

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/home/backup/backup/control%F';


单机环境全备脚本

mydate=`date +"%Y%m%d"`
BPATH=/home/backup/backup
export ORACLE_BASE=/home/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=lgjdb
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin

rman target / log ${BPATH}/rman_full_${mydate}.log append<<EOF
run
{allocate channel c1 type disk;
allocate channel c2 type disk;
backup database filesperset 4 format '${BPATH}/full_%d_%T_%s_%p';
sql 'alter system archive log current';
backup archivelog all format '${BPATH}/arch_%d_%T_%s_%p' delete input;
backup current controlfile format '${BPATH}/ctl_%d_%T_%s_%p';
crosscheck backup;
crosscheck archivelog all;
delete noprompt obsolete;
delete noprompt expired backup;
delete noprompt expired archivelog all;
}
EOF

for tfile in $(find ${BPATH}/ -mtime +14)
do
if [ -d $tfile ];then
rmdir $tfile
elif [ -f $tfile ];then
rm -f $tfile
fi

echo -e "---- Delete backup file: $tfile ------"

done

单机环境备归档脚本

mydate=`date +"%Y%m%d"`
BPATH=/home/backup/backup
export ORACLE_BASE=/home/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=lgjdb
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
rman target / log ${BPATH}/rman_arch_${mydate}.log append<<EOF
run
{allocate channel c1 type disk;
allocate channel c2 type disk;
sql 'alter system archive log current';
backup archivelog all format '${BPATH}/arch_%d_%T_%s_%p' delete input;
backup current controlfile format '${BPATH}/ctl_%d_%T_%s_%p';
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt expired archivelog all;
}
EOF

猜你喜欢

转载自www.cnblogs.com/liang545621/p/9090889.html