`
MicroJoey
  • 浏览: 87081 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

offline datafile and offline tablespace

阅读更多
1)offline datafile
OFFLINE
Specify OFFLINE to take the datafile offline. If the database is open, you must perform media recovery on the datafile before bringing it back online, because a checkpoint is not performed on the datafile before it is taken offline.

引用
DATA FILE #5:
  (name #4) /u01/oracle/oradata/PROD/example01.dbf
creation size=0 block size=8192 status=0x1c head=4 tail=4 dup=1
tablespace 6, index=5 krfil=5 prev_file=0
unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
Checkpoint cnt:75 scn: 0x0000.000e2959 05/04/2011 10:45:17
Stop scn: 0x0000.000e296f 05/04/2011 10:45:30
Creation Checkpointed at scn:  0x0000.00072202 03/12/2011 23:05:50
thread:0 rba:(0x0.0.0)


2)offline tablespace

引用
DATA FILE #4:
  (name #5) /u01/oracle/oradata/PROD/users01.dbf
creation size=0 block size=8192 status=0x80 head=5 tail=5 dup=1
tablespace 4, index=4 krfil=4 prev_file=0
unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
Checkpoint cnt:114 scn: 0x0000.000e268b 05/04/2011 10:28:24
Stop scn: 0x0000.000e268b 05/04/2011 10:28:24
Creation Checkpointed at scn:  0x0000.00002946 06/30/2005 19:10:40
thread:0 rba:(0x0.0.0)


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 datafiles are also offline.

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

OFFLINE NORMAL
Specify NORMAL to flush all blocks in all datafiles 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 datafiles 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.


SQL> alter tablespace users offline;

Tablespace altered.

SQL> alter tablespace users online;

Tablespace altered.

SQL> alter database datafile '/u01/oracle/oradata/PROD/users02.dbf' offline;

Database altered.

SQL> alter database datafile '/u01/oracle/oradata/PROD/users02.dbf' online;
alter database datafile '/u01/oracle/oradata/PROD/users02.dbf' online
*
ERROR at line 1:
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/u01/oracle/oradata/PROD/users02.dbf'


SQL> recover datafile 6;
Media recovery complete.
SQL> alter database datafile '/u01/oracle/oradata/PROD/users02.dbf' online;

Database altered.



分享到:
评论

相关推荐

    如何正确的删除Oracle表空间数据文件

    总结来说,删除Oracle表空间数据文件是一项需要谨慎操作的任务,理解`DROP DATAFILE`、`OFFLINE`和`OFFLINE DROP`的差异,以及掌握在OS层面误删后的恢复策略,对于维护数据库的完整性和一致性至关重要。在执行这些...

    CREATE TABLESPACE命令详解

    spec1 [, datafile_spec2] [{MINIMUM EXTENT integer [k|m] | BLOCKSIZE integer [k] | logging_clause | FORCE LOGGING | DEFAULT {data_segment_compression} storage_clause | [online | offline] | [PERMANENT |...

    oracle10g表空间操作命令

    CREATE TABLESPACE tablespace_name DATAFILE 'filepath' SIZE filesize AUTOEXTEND ON NEXT autosize MAXSIZE filemaxsize [UNLIMITED]; ``` 例如: ```sql CREATE TABLESPACE sales DATAFILE 'C:\1.txt' SIZE 10M ...

    oracle表空间操作详解

    ALTER TABLESPACE game ADD DATAFILE '/oracle/oradata/db/GAME02.dbf' SIZE 1000M; ``` - 手动增加数据文件尺寸: ```sql ALTER DATABASE DATAFILE '/oracle/oradata/db/GAME.dbf' RESIZE 4000M; ``` - 自动扩展...

    linux oracle 建表,表空间以及删除命令

    建立表空间的命令为:CREATE TABLESPACE data01 DATAFILE '/oracle/oradata/db/DATA01.dbf' SIZE 500M UNIFORM SIZE 128k;其中,data01 是表空间的名称,/oracle/oradata/db/DATA01.dbf 是数据文件的路径,SIZE 500M...

    oracle表空间入门.doc

    CREATE TABLESPACE data01 DATAFILE '/oracle/oradata/db/DATA01.dbf' SIZE 500M UNIFORM SIZE 128k; ``` 其中,`UNIFORM SIZE 128k`指定了区尺寸为128k,如果不指定,默认为64k。 - **删除表空间**:使用`DROP ...

    Oracle_tablespace_(表空间)的创建、删除、修改、扩展及检查等

    datafile 'd:\oracle\oradata\ora92\luntan.ora' size 5m, 'd:\oracle\oradata\ora92\dd.ora' size 5m; 查询表空间的信息可以使用 DBA_TABLESPACES 视图,例如: select tablespace_name "表空间名称",status ...

    Oracle 表空间建立方法

    DROP TABLESPACE tablespace_name INCLUDING CONTENTS AND DATAFILES; ``` 以上步骤涵盖了Oracle数据库中表空间的创建、修改、删除等基本操作。根据实际需求灵活运用这些命令,可以帮助管理员更高效地管理数据库...

    oracle表空间和数据文件的详细操作(纯手工)

    ALTER TABLESPACE DATA01 DATAFILE OFFLINE; ``` - **将数据文件设为在线**: ```sql ALTER DATABASE DATAFILE 'C:\DATA01B.DBF' ONLINE; ``` #### 6. 移动和重命名数据文件 当需要更改数据文件的位置时,...

    ORACLE表空间操作

    CREATE TABLESPACE tablespace_name DATAFILE 'filepath' SIZE filesize AUTOEXTEND ON NEXT autosize MAXSIZE filemaxsize [UNLIMITED]; ``` 例如: ```sql CREATE TABLESPACE sales DATAFILE 'C:\1.txt' SIZE 10M ...

    ORACLE常用命令之二

    DATAFILE 'file_path' SIZE size [LOGGING/NOLOGGING] DEFAULT STORAGE (initial size NEXT size MAXEXTENTS max_extents PCTINCREASE increase) [ONLINE/OFFLINE] [PERMANENT/TEMPORARY] [EXTENT_MANAGEMENT_CLAUSE...

    Oracle_create_tablespace语法详解.docx

    本文将对 Oracle Create Tablespace 语法进行详细的解释和分析,从 undo 表空间到表空间的创建,DATAFILE 的设置,MININUM EXTENT,BLOCKSIZE,logging clause,FORCE LOGGING,DEFAULT storage_clause 等方面。...

    ORACLE 表空间的部分操作

    ALTER TABLESPACE game ADD DATAFILE '/oracle/oradata/db/GAME02.dbf' SIZE 1000M; ``` 2. **手动调整数据文件大小**:直接更改现有数据文件的大小。 ```sql ALTER DATABASE DATAFILE '/oracle/oradata/db/GAME...

    数据库常用操作命令.docx

    创建永久表空间:create [smallfile | bigfile] [permanent] tablespace 表空间名 datafile '(可附路径)数据文件名.dbf'[size 10m] [autoextend off on] [next 10m] [maxsize unlimited 10m] [online offline];...

    Oracle表空间操作详解.docx

    ALTER TABLESPACE <tablespace_name> ADD DATAFILE 'filepath' SIZE <filesize> AUTOEXTEND [ON|OFF] NEXT <autosize> MAXSIZE <maxsize> [UNLIMITED]; ``` 例如: ```sql ALTER TABLESPACE sales ADD DATA...

    管理表空间和数据文件.pdf

    - 永久表空间:用于存储常规数据,如`CREATE TABLESPACE demouserts01 DATAFILE 'path/file.dbf' SIZE 10M AUTOEXTEND ON NEXT 1M MAXSIZE 200M;` - 索引表空间:专用于存储索引,语法同上,只需替换表空间名。 -...

    ORACLE_表空间操作(图)

    ALTER TABLESPACE IDO ADD DATAFILE 'f:\zjd\ido.dbf' SIZE 1M REUSE; ``` - **设置只读状态**: ```sql ALTER TABLESPACE "IDO" READONLY; ``` - **设置脱机状态**: ```sql ALTER TABLESPACE "IDO" ...

    oracle表空间命令语句大全

    CREATE TABLESPACE data01 DATAFILE '/oracle/oradata/db/DATA01.dbf' SIZE 500M UNIFORM SIZE 128k; 在上面的命令中,DATAFILE 选项用于指定表空间的存储文件,SIZE 选项用于指定表空间的初始大小,而 UNIFORM ...

Global site tag (gtag.js) - Google Analytics