oracle 如何快速关库

2023年 9月 25日 88.0k 0

SHUTDOWN ABORT is the fastest way to shutdown an Oracle database.  However, this type of shutdown leaves the database in a inconsistent state (non-rolled back) any backups taken at this point would require recovery at the next startup (See NOTE 1 below)

*** NOTE *** SHUTDOWN ABORT is not recommended for databases prior to 8.1.6 as the chances of corrupting the database are much higher in such older versions.

1) Determine how much rollback (in bytes) is needed for a clean shutdown using the following query:

select sum(used_ublk) * from v$transaction;

2) SHUTDOWN ABORT

This will terminate all processes (CLIENT and BACKGROUND) as quickly as possible with no transaction rollback. 
A SHUTDOWN IMMEDIATE will cause SMON to try to terminate all client processes (SIGKILL) but there are many cases where SMON cannot do so in a timely manner hence the reason for the SHUTDOWN ABORT. (See NOTE 2 below)

3) From the results in #1 and your experience with your database, determine if you can wait for a clean shutdown (shutdown immediate).  If you cannot wait for a shutdown immediate, then skip the remaining steps and at the next startup SMON will rollback the transactions.

4) STARTUP RESTRICT

5) Watch the rollback (number of blocks) with the following query:
   
select sum(distinct(ktuxesiz)) from x$ktuxe where ktuxecfl = 'DEAD';

6) When the rollback has completed (which can be immediately after startup), issue SHUTDOWN IMMEDIATE.

简单说就是: 

1.
SHUTDOWN ABORT
将不进行事务回滚,快速的中断所有进程 (客户端 和 后台)。 

 2.
STARTUP RESTRICT 

通过下面的查询查看回滚(块的个数) 

select sum(distinct(ktuxesiz)) from x$ktuxe where ktuxecfl = 'DEAD'; 

 3. 回滚完成 再shutdown immediate

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论