Oracle 数据库 control file的备份

自动备份

间接的是指,如果启用了CONTROLFILE AUTOBACKUP,那么备份时,也会把control file带上:

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP OFF;new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
new RMAN configuration parameters are successfully storedRMAN> backup spfile;Starting backup at 15-DEC-23
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=264 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 15-DEC-23
channel ORA_DISK_1: finished piece 1 at 15-DEC-23
piece handle=/opt/oracle/product/19c/dbhome_1/dbs/012e36jf_1_1 tag=TAG20231215T095703 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-DEC-23RMAN> CONFIGURE CONTROLFILE AUTOBACKUP CLEAR;old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
RMAN configuration parameters are successfully reset to default valueRMAN> backup spfile;Starting backup at 15-DEC-23
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 15-DEC-23
channel ORA_DISK_1: finished piece 1 at 15-DEC-23
piece handle=/opt/oracle/product/19c/dbhome_1/dbs/022e36k3_1_1 tag=TAG20231215T095723 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-DEC-23Starting Control File and SPFILE Autobackup at 15-DEC-23
piece handle=/opt/oracle/product/19c/dbhome_1/dbs/c-2920819444-20231215-00 comment=NONE
Finished Control File and SPFILE Autobackup at 15-DEC-23

手动备份

手动备份可通过RMAN或SQL命令。

RMAN 手动备份

RMAN> backup current controlfile;Starting backup at 15-DEC-23
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 15-DEC-23
channel ORA_DISK_1: finished piece 1 at 15-DEC-23
piece handle=/opt/oracle/product/19c/dbhome_1/dbs/042e370v_1_1 tag=TAG20231215T100415 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-DEC-23Starting Control File and SPFILE Autobackup at 15-DEC-23
piece handle=/opt/oracle/product/19c/dbhome_1/dbs/c-2920819444-20231215-01 comment=NONE
Finished Control File and SPFILE Autobackup at 15-DEC-23

很神奇,spfile也自动备份了。

SQL 手动备份

ALTER DATABASE BACKUP CONTROLFILE TO TRACE

在alert log中可以找到trace file的位置:

alert_ORCLCDB.log:Backup controlfile written to trace file 

输出的SQL脚本:

/opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/ORCLCDB_ora_3449.trc
$ cat /opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/ORCLCDB_ora_3449.trc
Trace file /opt/oracle/diag/rdbms/orclcdb/ORCLCDB/trace/ORCLCDB_ora_3449.trc
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
Build label:    RDBMS_19.3.0.0.0DBRU_LINUX.X64_190417
ORACLE_HOME:    /opt/oracle/product/19c/dbhome_1
System name:    Linux
Node name:      oracle-19c-vagrant
Release:        5.4.17-2136.323.8.2.el7uek.x86_64
Version:        #2 SMP Wed Sep 20 00:06:39 PDT 2023
Machine:        x86_64
Instance name: ORCLCDB
Redo thread mounted by this instance: 1
Oracle process number: 35
Unix process pid: 3449, image: oracle@oracle-19c-vagrant (TNS V1-V3)*** 2023-12-15T09:52:20.683367+08:00 (CDB$ROOT(1))
*** SESSION ID:(268.60469) 2023-12-15T09:52:20.683403+08:00
*** CLIENT ID:() 2023-12-15T09:52:20.683411+08:00
*** SERVICE NAME:(SYS$USERS) 2023-12-15T09:52:20.683416+08:00
*** MODULE NAME:(sqlplus@oracle-19c-vagrant (TNS V1-V3)) 2023-12-15T09:52:20.683423+08:00
*** ACTION NAME:() 2023-12-15T09:52:20.683428+08:00
*** CLIENT DRIVER:(SQL*PLUS) 2023-12-15T09:52:20.683432+08:00
*** CONTAINER ID:(1) 2023-12-15T09:52:20.683438+08:00-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="ORCLCDB"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=/opt/oracle/product/19c/dbhome_1/dbs/arch'
-- LOG_ARCHIVE_DEST_1='MANDATORY REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER'
-- LOG_ARCHIVE_DEST_1='NOALTERNATE'
-- LOG_ARCHIVE_DEST_1='NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE
--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
--     Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCLCDB" NORESETLOGS  NOARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 1024MAXINSTANCES 8MAXLOGHISTORY 292
LOGFILEGROUP 1 '/opt/oracle/oradata/ORCLCDB/redo01.log'  SIZE 200M BLOCKSIZE 512,GROUP 2 '/opt/oracle/oradata/ORCLCDB/redo02.log'  SIZE 200M BLOCKSIZE 512,GROUP 3 '/opt/oracle/oradata/ORCLCDB/redo03.log'  SIZE 200M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE'/opt/oracle/oradata/ORCLCDB/system01.dbf','/opt/oracle/oradata/ORCLCDB/sysaux01.dbf','/opt/oracle/oradata/ORCLCDB/undotbs01.dbf','/opt/oracle/oradata/ORCLCDB/pdbseed/system01.dbf','/opt/oracle/oradata/ORCLCDB/pdbseed/sysaux01.dbf','/opt/oracle/oradata/ORCLCDB/users01.dbf','/opt/oracle/oradata/ORCLCDB/pdbseed/undotbs01.dbf','/opt/oracle/oradata/ORCLCDB/ORCLPDB1/system01.dbf','/opt/oracle/oradata/ORCLCDB/ORCLPDB1/sysaux01.dbf','/opt/oracle/oradata/ORCLCDB/ORCLPDB1/undotbs01.dbf','/opt/oracle/oradata/ORCLCDB/ORCLPDB1/users01.dbf','/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_system_llnsto42_.dbf','/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_sysaux_llnsto4j_.dbf','/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_undotbs1_llnsto4o_.dbf','/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_users_llnsto4z_.dbf'
CHARACTER SET AL32UTF8
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/opt/oracle/product/19c/dbhome_1/dbs/arch1_1_1005785759.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/opt/oracle/product/19c/dbhome_1/dbs/arch1_1_1149758071.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Open all the PDBs.
ALTER PLUGGABLE DATABASE ALL OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/oradata/ORCLCDB/temp01.dbf'SIZE 135266304  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = "PDB$SEED";
ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/oradata/ORCLCDB/pdbseed/temp012023-10-09_09-26-58-555-AM.dbf'SIZE 37748736  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = "ORCLPDB1";
ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/temp01.dbf'SIZE 37748736  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = "ORCLPDB2";
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_temp_llnsto4t_.dbf' REUSE;
ALTER SESSION SET CONTAINER = "CDB$ROOT";
-- End of tempfile additions.
--
--     Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCLCDB" RESETLOGS  NOARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 1024MAXINSTANCES 8MAXLOGHISTORY 292
LOGFILEGROUP 1 '/opt/oracle/oradata/ORCLCDB/redo01.log'  SIZE 200M BLOCKSIZE 512,GROUP 2 '/opt/oracle/oradata/ORCLCDB/redo02.log'  SIZE 200M BLOCKSIZE 512,GROUP 3 '/opt/oracle/oradata/ORCLCDB/redo03.log'  SIZE 200M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE'/opt/oracle/oradata/ORCLCDB/system01.dbf','/opt/oracle/oradata/ORCLCDB/sysaux01.dbf','/opt/oracle/oradata/ORCLCDB/undotbs01.dbf','/opt/oracle/oradata/ORCLCDB/pdbseed/system01.dbf','/opt/oracle/oradata/ORCLCDB/pdbseed/sysaux01.dbf','/opt/oracle/oradata/ORCLCDB/users01.dbf','/opt/oracle/oradata/ORCLCDB/pdbseed/undotbs01.dbf','/opt/oracle/oradata/ORCLCDB/ORCLPDB1/system01.dbf','/opt/oracle/oradata/ORCLCDB/ORCLPDB1/sysaux01.dbf','/opt/oracle/oradata/ORCLCDB/ORCLPDB1/undotbs01.dbf','/opt/oracle/oradata/ORCLCDB/ORCLPDB1/users01.dbf','/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_system_llnsto42_.dbf','/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_sysaux_llnsto4j_.dbf','/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_undotbs1_llnsto4o_.dbf','/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_users_llnsto4z_.dbf'
CHARACTER SET AL32UTF8
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/opt/oracle/product/19c/dbhome_1/dbs/arch1_1_1005785759.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/opt/oracle/product/19c/dbhome_1/dbs/arch1_1_1149758071.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Open all the PDBs.
ALTER PLUGGABLE DATABASE ALL OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/oradata/ORCLCDB/temp01.dbf'SIZE 135266304  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = "PDB$SEED";
ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/oradata/ORCLCDB/pdbseed/temp012023-10-09_09-26-58-555-AM.dbf'SIZE 37748736  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = "ORCLPDB1";
ALTER TABLESPACE TEMP ADD TEMPFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/temp01.dbf'SIZE 37748736  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = "ORCLPDB2";
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/ORCLCDB/07AB4734637A6E5DE0630101007F8538/datafile/o1_mf_temp_llnsto4t_.dbf' REUSE;
ALTER SESSION SET CONTAINER = "CDB$ROOT";
-- End of tempfile additions.
--

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/223152.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Springboot自带logback日志配置学习

文档地址 官网地址:Core Features 中文文档地址:四、Spring Boot 特性 Spring Boot 中文文档 暂时还没有实际操作,待更新

忘记了路由器的用户名和密码,怎么办?

注意:登录窗口会显示路由器型号,请务必确认是您自己路由器的界面。 解决方法 尝试输入登录密码 如果您的确忘了设置好的密码,就只能把路由器恢复出厂设置,没有超级密码。 恢复出厂前,不妨尝试输入可能的管理密码。一…

和鲸科技携手深圳数据交易所,“数据+数据开发者生态”赋能人工智能产业发展

信息化时代,数据驱动决策的重要性日益凸显。通过利用数据可以深入了解市场需求、客户行为、竞争态势等关键信息,从而制定更为有效的战略和决策。围绕推动数据要素产业发展,近日,深圳数据交易所(以下简称“深数所”&…

【注解和反射】--03 类的加载、ClassLoader

反射 【Class】哪些类型可以有Class对象? class:外部类,成员(成员内部类,静态内部类),局部内部类,匿名内部类interface:接口[]:数组enum:枚举annotation:注…

uniapp,点击选中并改变颜色,第二次点击取消选中状态

一、效果图 二、代码实现 字符串的indexOf和数组的indexOf用法一致! arr.indexOf(item) 该方法返回某个元素在数组中的位置。若没检索到,则返回 -1。 关键代码:(通过:class绑定) :class"selectList.indexOf(sub.type) ! -1 ? right_ite…

Linux,Windows或macOS系统的电脑怎样才能投屏到手机?

很多人都知道手机投屏到电脑的方法,但想要反过来的时候,却束手无策。 如果你想要将电脑投屏到手机,无论你的电脑是Windows,Linux还是macOS系统,无论你的手机是安卓、iOS还是鸿蒙,都可以用下面这个方法实现电…

c/c++ 文件操作(2)

文件操作读和写 顺序读写 1、fgetc、fputc 函数功能fgetc字符输入函数----->对应打开方式是 “r”fputc字符输出函数-----> 对应打开方式是 “w” 2、fgets、fputs 函数功能fgets文本行输入函数------> 对应打开方式是"r"fputs文本行输出函数------>…

Git 命令使用总结

git init: 在当前目录创建一个新的空Git仓库。git clone [url]: 从远程仓库克隆一个项目到本地。git add [file]: 将文件添加到暂存区。git commit -m “message”: 提交暂存区的文件到本地仓库,并添加一条提交信息。git status: 查看当前工作区的状态(已…

说说对React高阶组件的理解?应用场景?

面试官:说说对高阶组件的理解?应用场景? 一、是什么 高阶函数(Higher-order function),至少满足下列一个条件的函数 接受一个或多个函数作为输入输出一个函数 在React中,高阶组件即接受一个或多个组件作…

销售技巧培训之销售如何开场白

销售技巧培训之销售如何开场白 在销售过程中,开场白是至关重要的。一个好的开场白可以吸引客户的注意力,激发他们的兴趣,为后续的销售过程打下坚实的基础。然而,很多销售人员往往在开场白环节就犯下了错误,导致销售失…

go学习之网络编程

文章目录 网络编程1、网络编程的基本介绍2.网络编程的基础知识1)协议(tcp/ip)2)OSI与TCP/ip参考模型3)ip地址4)端口(port)介绍5)tcp socket编程的客户端和服务器端 3.socket编程快速入门4.经典项目-海量用户即时通讯系…

工作记录----常用注解-----12.11

@Slf4j 它可以帮助在类中自动生成一个名为 log 的日志对象,使得在类中可以直接使用这个日志对象进行日志记录 具体来说,当你在类上添加 @Slf4j 注解后,在该类中就可以直接使用 log 对象来记录日志,无需手动创建和初始化日志对象,简化了日志的使用。例如: @Slf4j publi…

SpringBoot 3.2.0 版本 mysql 依赖下载错误

最近想尝试一下最新的 SpringBoot 项目,于是将自己的开源项目进行了一些升级。 JDK 版本从 JDK8 升级至 JDK17。SpringBoot 版本从 SpringBoot 2.7.3 升级到 SpringBoot 3.2.0 其中 JDK 的升级比较顺利,毕竟 JDK 的旧版本兼容性一直非常好。 但是在升级…

【XR806开发板试用】+ 通过网络控制led并上报按键状态

通过网络控制led并上报按键状态 本次做一个手机通过mqtt服务器控制板子上的LED亮灭,板子也可以将按钮状态变化通过mqtt服务器上报给手机的功能 硬件上,从原理图看,LED接到了PA21,高电平点亮。 按键则时接到了PA11,并…

C# 事件和委托的区别

这里在类中定义了一个委托和一个事件 public class MyTimerClass {// 事件public event EventHandler MyEvent;// 委托public delegate void Mydel();public Mydel mydel;public MyTimerClass(){MyEvent MyTimerClass_MyEvent;mydel new Mydel(MydelMethod);}private void M…

显示当前目录的路径

pwd 当然,当在多处列出各个目录的内容时,可能会搞不清楚到底自己处于文件系统的哪个位置上。如何判断自己当前位于哪个工作目录呢?答案就是pwd命令,它代表print working directory(打印工作目录)。 说明 …

GitHub帐户管理更改电子邮件

登录到您的 GitHub 帐户: 前往 GitHub 网站并使用您的凭据登录。 访问个人设置: 单击右上角的您的头像,然后选择“Settings”(设置)。 选择电子邮件选项卡: 在左侧边栏中选择“Emails”(电子邮…

gradle-5.4.1-all下载时出现了Connect timed out

问题描述:最近在学习如何在手机端部署YOLO,出现了许多错误,其中之一的错误:gradle-5.4.1-all下载时出现了Connect timed out,大家都知道这是从国外网站下载网络问题导致的。 解决办法: 在我们创建项目中的一个路径下…

【深度学习】强化学习(三)强化学习的目标函数

文章目录 一、强化学习问题1、交互的对象2、强化学习的基本要素3、策略(Policy)4、马尔可夫决策过程5、强化学习的目标函数1. 总回报(Return)2. 折扣回报(Discounted Return)a. 折扣率b. 折扣回报的定义 3.…

钉钉机器人发送表格

背景: 由于每次发送excel连接,不太好看,想着简单的表格直接用消息的方式发送在群里,就想着弄一个直接发送的表格信息,但是钉钉官网是没有的。 我估计钉钉的开发人员也没有想过,会有人钻空子,用markdown发送…