oracle备份 操作,oracle备份恢复中用到的几个操作

主要区别:

ALTER SYSTEM SWITCH LOGFILE 对单实例数据库或RAC中的当前实例执行日志切换。

ALTER SYSTEM ARCHIVE LOG CURRENT 会对数据库中的所有实例执行日志切换。

详细解释:

我们都知道在自动归档的数据库中,这两个命令几乎产生的结果是一样的。来看看oracle的解释:

ALTER SYSTEM SWITCH LOGFILE ;

SWITCH LOGFILE Clause

The SWITCH LOGFILE clause lets you explicitly force Oracle to begin

writing to a new redo log file group, regardless of whether the

files in the current redo log file group are full. When you force a

log switch, Oracle begins to perform a checkpoint but returns

control to you immediately rather than when the checkpoint is

complete. To use this clause, your instance must have the database

open.

ALTER SYSTEM ARCHIVE LOG CURRENT ;

CURRENT Clause

Specify CURRENT to manually archive the current redo log file group

of the specified thread, forcing a log switch. If you omit the

THREAD parameter, then Oracle archives all redo log file groups

from all enabled threads, including logs previous to current logs.

You can specify CURRENT only when the database is open.

ALTER SYSTEM ARCHIVE LOG CURRENT NOSWITCH;

NOSWITCH

Specify NOSWITCH if you want to manually archive the current redo

log file group without forcing a log switch. This setting is used

primarily with standby databases to prevent data divergence when

the primary database shuts down. Divergence implies the possibility

of data loss in case of primary database failure.

You can use the NOSWITCH clause only when your instance has the

database mounted but not open. If the database is open, then this

operation closes the database automatically. You must then manually

shut down the database before you can reopen it

我们首先要明白两个事实:

一个就是在logfile switch的时候会触发arch进程,即通知归档进程说那个日志可以归档了。

另一个是logfile

switch的时候会触发ckpt进程。而ckpt进程又会触发dbwr进程。dbwr进程会把上一个redo中保护的储藏在buffer

cache中的dirty buffer全部写回磁盘。然后,ckpt进程纪录scn到controlfile中,这时会把redo

log的状态由active 变成inactive。

由此我们可以看出处于inactive状态的redo log对于instance recovery是没有用处了。但是它可能对于meda

recovery还有用处,因为处于inactive状态的redo log可能已经归档,也可能没有归档。

出现 checkpoint not complete,unable to allocate new redo log

file的错误,是因为lgwr要覆盖一个其上检查点过程没有结束的日志文件,lgwr会等待dbwr完成,同时出现此错误。出现这个错误的原因,大概有几点,一个是dbwr写出速度太慢,一个是buffer

cache中的脏数据太多。即事务太频繁,另一个也可能是日志太小,或日志组太少导致的。

备份恢复中用到的几个操作:

alter system checkpoint;

alter system archive log all;

alter system archive log current;

alter system switch

logfile;

1:alter system checkpoint;

Specify CHECKPOINT to explicitly force Oracle to perform a

checkpoint, ensuring that all changes made by committed

transactions are written to datafiles on disk. You can specify this

clause only when your instance has the database open. Oracle does

not return control to you until the checkpoint is complete.

强迫oracle进行以次检查点,确保所有提交的事务的改变都被写到磁盘数据文件上。但此时数据库必须是打开的状态。

2: alter system archive log all;

手工归档所有的日志文件组。

3:alter system archive log current

手工归档活动的日志文件组。

4: alter system switch logfile;

The SWITCH LOGFILE clause lets you explicitly force Oracle to begin

writing to a new redo log file group, regardless of whether the

files in the current redo log file group are full. When you force a

log switch, Oracle begins to perform a checkpoint but returns

control to you immediately rather than when the checkpoint is

complete. To use this clause, your instance must have the database

open.

开始写新的日志文件组。不管当前日志文件组是否满了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于Oracle数据库备份操作,可以根据具体情况选择不同的备份方案。以下是一些可能的情况和相应的备份方案: 1. 完全备份:这是最基本的备份方式,将数据库的所有数据和日志文件一起备份。这种备份方案适用于数据量较小、备份时间窗口较大、恢复时间要求较低的情况。 2. 增量备份:在完全备份的基础上,只备份自上次完全备份以来发生的变化的数据和日志文件。这种备份方案适用于数据量较大、备份时间窗口较小、恢复时间要求较高的情况。 3. 差异备份:在完全备份的基础上,只备份自上次完全备份以来发生的差异数据和日志文件。与增量备份不同的是,差异备份备份自上次完全备份以来的所有变化,而不仅仅是最近一次的变化。这种备份方案适用于数据量较大、备份时间窗口较小、恢复时间要求较高的情况。 4. 冷备份:在数据库关闭的情况下进行备份。这种备份方案适用于对数据库的停机时间不敏感的情况。 5. 热备份:在数据库运行的情况下进行备份。这种备份方案适用于对数据库的停机时间敏感的情况。 6. 异地备份:将备份数据存储在不同地点的备份介质上,以防止灾难性事件发生时的数据丢失。这种备份方案适用于对数据的安全性要求较高的情况。 根据实际需求和条件,选择适合的备份方案可以保证数据库的安全性和可靠性。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Oracle备份的几种方式](https://blog.csdn.net/enjoysummer/article/details/107857269)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [Oracle数据库的数据备份](https://blog.csdn.net/m0_71406734/article/details/130451386)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值