练习冷备份时的杂想

1、oracle.exe启动后,在sqlplus里输入shutdown immediate命令也不会使oracle.exe结束运行,依然是启动状态


2、冷备份时,用shutdown immediate(除abort外)等,表示数据库关闭前做了一次完全检查点。所以,当用冷备份来启动数据库时就不用实例恢复了。


3、数据文件从offline状态到online状态中间,需要recover 这一步,不然提示出错‘recover’。

      alter database datafile 5 offline;》recover datafile 5;》alter database datafile 5 online;

       因为offline这一操作时,未对该数据文件做一次完全检查点,所以online前要recover介质恢复。

       若offline这一操作时后 ,关闭实例,再启动实例,也还是要online前要recover介质恢复,因为启动实例时该数据文件处于offline状态,所以未对它做实例恢复。

 

      如果是表空间,则可以直接从offline状态到online状态进行切换,具体语句如下:

      alter tablespace XXXX offline;》alter tablespace XXXX online;

      这是 因为表空间执行offline这一操作时,对旗下所属的所有数据文件做一次完全检查点。

 

     不知道上述这两小点和对象的存储结构有关,比如一个分区表虽然限制在一个表空间上,但是可以分布在该表空间的多个数据文件。一个表段可以分布在多个数据文件中

     看 何明     备份与恢复


一个表分布在表空间A的多个数据文件上,若其中一个数据文件脱机了,此时做文件检查点是没必要的,一是表还可以在修改在其他数据文件上,该数据文件联机时,要介质恢复,二是该数据文件的checkpoint_change#和该表空间的其他数据文件的不一致。

表空间脱机后联机不用恢复是因为大家数据文件的checkpoint_change#一致,因为脱机时做了检查点了。

alter_tablespace

tablespace_state_clauses

Use these clauses to set or change the state of the tablespace.

ONLINE | OFFLINE

Specify ONLINE to bring the tablespace online. Specify OFFLINE to take the tablespace offline and prevent further access to its segments. When you take a tablespace offline, all of its data files are also offline.

Suggestion:

Before taking a tablespace offline for a long time, consider changing the tablespace allocation of any users who have been assigned the tablespace as either a default or temporary tablespace. While the tablespace is offline, such users cannot allocate space for objects or sort areas in the tablespace. See ALTER USER for more information on allocating tablespace quota to users.

Restriction on Taking Tablespaces Offline You cannot take a temporary tablespace offline.

OFFLINE NORMAL Specify NORMAL to flush all blocks in all data files in the tablespace out of the system global area (SGA). You need not perform media recovery on this tablespace before bringing it back online. This is the default.

OFFLINE TEMPORARY If you specify TEMPORARY, then Oracle Database performs a checkpoint for all online data files in the tablespace but does not ensure that all files can be written. Files that are offline when you issue this statement may require media recovery before you bring the tablespace back online.

OFFLINE IMMEDIATE  If you specify IMMEDIATE, then Oracle Database does not ensure that tablespace files are available and does not perform a checkpoint. You must perform media recovery on the tablespace before bringing it back online.

注释:

OFFLINE NORMAL,一要该表空间的所有数据文件联机,二才会做做检查点

OFFLINE TEMPORARY时会对此时联机的该表空间的数据文件做检查点,而此时脱机的该表空间的数据文件(alter database datafile offline)不做检查点。

参考:

ALTER DATABASE 与 ALTER TABLESPACE OFFLINE的区别

单纯的offline datafile,将不会触发文件检查点,只有针对offline tablespace的时候才会触发文件检查点,这也是为什么online datafile需要media recovery而online tablespace不需要。

          


 

4、diag目录下的rdbms(表示数据库实例的意思)目录下trace目录里有前台和后台进程各自的跟踪文件,还有告警日志,后台进程的跟踪文件,一般称为  进程     日志。

      diag目录下的各个目录,是分别与oracle软件系统的不同功能模块对应的。


5、参数文件:用于实例的配置(主要配置实例里的内存部分)

      控制文件:用于数据文件和日志文件状态的记录,而实例通过  控制文件来了解数据文件和日志文件状态。

  参数文件  里 有     控制文件  位置信息,控制文件  里 有   数据文件和日志文件  位置信息。

      口令文件:用于用户进程连接到服务端的数据库的服务进程时对用户进程发来的信息进行验证,验证通过,才可以连接(成功)。

 

 

 

6、select count(*) from v$parameter

在nomount和open时值一样 说明v$parameter内容来自参数文件。


7、alter database rename file '................'   to  '................';

这个语句只能在mount阶段可以执行,因为此时数据文件没有处于打开状态。

该语句针对的文件除了数据文件、重做日志文件外,也可用于临时文件(即临时表空间的数据文件)。


参考:

Useful and Simple srcipts for Oracle CoolBackup

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值