您的位置:首页 > 教育 > 锐评 > 手机网站建设图片素材_数据管理系统_免费seo推广计划_重庆快速网络推广

手机网站建设图片素材_数据管理系统_免费seo推广计划_重庆快速网络推广

2025/1/8 6:43:22 来源:https://blog.csdn.net/m0_75153183/article/details/144737525  浏览:    关键词:手机网站建设图片素材_数据管理系统_免费seo推广计划_重庆快速网络推广
手机网站建设图片素材_数据管理系统_免费seo推广计划_重庆快速网络推广

记录

1 docker安装Oracle环境

安装环境:

docker中安装Oracle 11g_docker 安装oracle 11g-CSDN博客

创建表空间并连接:

Oracle创建表空间_oracle 创建临时表空间-CSDN博客

导入测试数据:

Oracle数据泵expdp/impdp备份还原步骤_expdp 备份数据库-CSDN博客 中的步骤1

2 配置rman参数

进入容器启动rman

[root@plmomn-gw ~]# docker exec -it oracle11g bash[oracle@8e8c0284077f /]$ rman target / Recovery Manager: Release 11.2.0.1.0 - Production on Thu Dec 26 11:10:23 2024Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.connected to target database: HELOWIN (DBID=1384114315)RMAN> 

查看配置参数:

RMAN> show all;using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name HELOWIN are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home/oracle/app/oracle/product/11.2.0/dbhome_2/dbs/snapcf_helowin.f'; # default

修改配置:

设置备份保留策略,基于冗余数据保存2份:

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored

控制文件自动备份打开:

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

设置控制文件自动备份格式和路径:

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data/oracle/bak/%F';new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data/oracle/bak/%F';
new RMAN configuration parameters are successfully stored

3 创建备份脚本

参考:

Oracle系列之二:设置RMAN自动备份策略_rman配置打开控制文件自动备份、备份保留副本数为2-CSDN博客

 

[oracle@8e8c0284077f bak]$ vi rmanbak.sh
#/bin/bash
su - oracle -c "rman target /"<<EOF
run{#配置两个本地通道allocate channel c1 type disk;allocate channel c2 type disk;#归档当前的重做日志文件sql 'alter system archive log current';#备份全库及控制文件、服务器参数文件的压缩备份集
#备份所有归档的重做日志,并删除已备份的归档日志
# %d 数据库名称,%U 一个唯一的文件名,代表%u_%p_%c backup as compressed backupset database format '/data/oracle/bak/%d_rmanbak_%u' plus archivelog delete all input format '/data/oracle/bak/ARCH_%U';#核对所有备份集crosscheck backup;#核对归档日志crosscheck archivelog all;#删除过期备份集(noprompt=不提示)delete noprompt expired backup;#删除类型为disk的过期备份delete noprompt obsolete device type disk;#释放通道release channel c1;release channel c2;
}
exit;
EOF

4 设置脚本执行权限

vi rmanbak.sh

5 验证脚本能否正常执行

在容器内执行失败:

[oracle@8e8c0284077f bak]$ ./rmanbak.sh
standard in must be a tty

切换成root账号执行

[oracle@8e8c0284077f bak]$ su root
Password: 
[root@8e8c0284077f bak]# ./rmanbak.shRecovery Manager: Release 11.2.0.1.0 - Production on Thu Dec 26 16:54:56 2024Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.connected to target database: HELOWIN (DBID=1384114315)RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=226 device type=DISKallocated channel: c2
channel c2: SID=242 device type=DISKsql statement: alter system archive log currentStarting backup at 26-DEC-24
current log archived
channel c1: starting compressed archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=39 RECID=1 STAMP=1188577438
input archived log thread=1 sequence=40 RECID=2 STAMP=1188577444
input archived log thread=1 sequence=41 RECID=3 STAMP=1188590768
input archived log thread=1 sequence=42 RECID=4 STAMP=1188633638
input archived log thread=1 sequence=43 RECID=5 STAMP=1188644423
channel c1: starting piece 1 at 26-DEC-24
channel c2: starting compressed archived log backup set
channel c2: specifying archived log(s) in backup set
input archived log thread=1 sequence=44 RECID=6 STAMP=1188677180
input archived log thread=1 sequence=45 RECID=7 STAMP=1188691253
input archived log thread=1 sequence=46 RECID=8 STAMP=1188730811
input archived log thread=1 sequence=47 RECID=9 STAMP=1188752098
channel c2: starting piece 1 at 26-DEC-24
channel c1: finished piece 1 at 26-DEC-24
piece handle=/data/oracle/bak/ARCH_0c3dlqn2_1_1 tag=TAG20241226T165458 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:07
channel c1: deleting archived log(s)
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_24/o1_mf_1_39_mpnvwysk_.arc RECID=1 STAMP=1188577438
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_24/o1_mf_1_40_mpnvx4m3_.arc RECID=2 STAMP=1188577444
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_24/o1_mf_1_41_mpo8xjlg_.arc RECID=3 STAMP=1188590768
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_25/o1_mf_1_42_mppls6dy_.arc RECID=4 STAMP=1188633638
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_25/o1_mf_1_43_mppxb7fo_.arc RECID=5 STAMP=1188644423
channel c1: starting compressed archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=48 RECID=10 STAMP=1188752098
channel c1: starting piece 1 at 26-DEC-24
channel c2: finished piece 1 at 26-DEC-24
piece handle=/data/oracle/bak/ARCH_0d3dlqn2_1_1 tag=TAG20241226T165458 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:07
channel c2: deleting archived log(s)
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_25/o1_mf_1_44_mpqx9wj6_.arc RECID=6 STAMP=1188677180
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_26/o1_mf_1_45_mprc1ojb_.arc RECID=7 STAMP=1188691253
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_26/o1_mf_1_46_mpskovly_.arc RECID=8 STAMP=1188730811
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_26/o1_mf_1_47_mpt6h20q_.arc RECID=9 STAMP=1188752098
channel c1: finished piece 1 at 26-DEC-24
piece handle=/data/oracle/bak/ARCH_0e3dlqn9_1_1 tag=TAG20241226T165458 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:00
channel c1: deleting archived log(s)
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_26/o1_mf_1_48_mpt6h25y_.arc RECID=10 STAMP=1188752098
Finished backup at 26-DEC-24Starting backup at 26-DEC-24
channel c1: starting compressed full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00002 name=/home/oracle/app/oracle/oradata/helowin/sysaux01.dbf
input datafile file number=00006 name=/data/oracle/helowin/helowin.DBF
input datafile file number=00001 name=/home/oracle/app/oracle/oradata/helowin/system01.dbf
channel c1: starting piece 1 at 26-DEC-24
channel c2: starting compressed full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00005 name=/home/oracle/app/oracle/oradata/helowin/example01.dbf
input datafile file number=00003 name=/home/oracle/app/oracle/oradata/helowin/undotbs01.dbf
input datafile file number=00004 name=/home/oracle/app/oracle/oradata/helowin/users01.dbf
channel c2: starting piece 1 at 26-DEC-24
channel c2: finished piece 1 at 26-DEC-24
piece handle=/data/oracle/bak/HELOWIN_rmanbak_0g3dlqn9 tag=TAG20241226T165505 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:03
channel c1: finished piece 1 at 26-DEC-24
piece handle=/data/oracle/bak/HELOWIN_rmanbak_0f3dlqn9 tag=TAG20241226T165505 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:35
Finished backup at 26-DEC-24Starting backup at 26-DEC-24
current log archived
channel c1: starting compressed archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=49 RECID=11 STAMP=1188752140
channel c1: starting piece 1 at 26-DEC-24
channel c1: finished piece 1 at 26-DEC-24
piece handle=/data/oracle/bak/ARCH_0h3dlqoc_1_1 tag=TAG20241226T165540 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c1: deleting archived log(s)
archived log file name=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/archivelog/2024_12_26/o1_mf_1_49_mpt6jdsn_.arc RECID=11 STAMP=1188752140
Finished backup at 26-DEC-24Starting Control File and SPFILE Autobackup at 26-DEC-24
piece handle=/data/oracle/bak/c-1384114315-20241226-00 comment=NONE
Finished Control File and SPFILE Autobackup at 26-DEC-24crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/backupset/2024_12_24/o1_mf_annnn_TAG20241224T162359_mpnvwzbt_.bkp RECID=1 STAMP=1188577439
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/backupset/2024_12_24/o1_mf_nnndf_TAG20241224T162400_mpnvx0jy_.bkp RECID=2 STAMP=1188577440
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/backupset/2024_12_24/o1_mf_nnndf_TAG20241224T162400_mpnvx3l4_.bkp RECID=3 STAMP=1188577443
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/backupset/2024_12_24/o1_mf_annnn_TAG20241224T162404_mpnvx4pg_.bkp RECID=4 STAMP=1188577444
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data/oracle/bak/c-1384114315-20241224-00 RECID=5 STAMP=1188577445
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/backupset/2024_12_24/o1_mf_nnndf_TAG20241224T163745_mpnwps2y_.bkp RECID=6 STAMP=1188578265
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data/oracle/bak/c-1384114315-20241224-01 RECID=7 STAMP=1188578266
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data/oracle/bak/ARCH_0c3dlqn2_1_1 RECID=8 STAMP=1188752098
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data/oracle/bak/ARCH_0d3dlqn2_1_1 RECID=9 STAMP=1188752098
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data/oracle/bak/ARCH_0e3dlqn9_1_1 RECID=10 STAMP=1188752105
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data/oracle/bak/HELOWIN_rmanbak_0g3dlqn9 RECID=11 STAMP=1188752105
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data/oracle/bak/HELOWIN_rmanbak_0f3dlqn9 RECID=12 STAMP=1188752105
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data/oracle/bak/ARCH_0h3dlqoc_1_1 RECID=13 STAMP=1188752140
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/data/oracle/bak/c-1384114315-20241226-00 RECID=14 STAMP=1188752142
Crosschecked 14 objectsspecification does not match any archived log in the repositoryspecification does not match any backup in the repositoryRMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           1      24-DEC-24         Backup Piece       1      24-DEC-24          /home/oracle/app/oracle/flash_recovery_area/HELOWIN/backupset/2024_12_24/o1_mf_annnn_TAG20241224T162359_mpnvwzbt_.bkp
Backup Set           5      24-DEC-24         Backup Piece       5      24-DEC-24          /data/oracle/bak/c-1384114315-20241224-00
deleted backup piece
backup piece handle=/home/oracle/app/oracle/flash_recovery_area/HELOWIN/backupset/2024_12_24/o1_mf_annnn_TAG20241224T162359_mpnvwzbt_.bkp RECID=1 STAMP=1188577439
deleted backup piece
backup piece handle=/data/oracle/bak/c-1384114315-20241224-00 RECID=5 STAMP=1188577445
Deleted 2 objectsreleased channel: c1released channel: c2RMAN> Recovery Manager complete.

执行成功

 6 设置定时执行

退出容器到宿主机,添加定时任务

[root@plmomn-gw ~]# crontab -e
crontab: installing new crontab
[root@plmomn-gw ~]# crontab -l
05 15 * * * docker exec -u root oracle11g bash -c "cd /data/oracle/bak/;./rmanbak.sh"

执行成功

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com