Oracle表空间状态
生活随笔
收集整理的這篇文章主要介紹了
Oracle表空间状态
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1.表空間只讀
查看當(dāng)前表空間狀態(tài)
SYS@userdata>column file_name format a60 SYS@userdata>column tablespace_name format a20 SYS@userdata>select tablespace_name,file#,file_name,v.status,v.enabled from dba_data_files d,v$datafile v where d.file_id=v.file#;TABLESPACE_NAME FILE# FILE_NAME STATUS ENABLED -------------------- ---------- ------------------------------------------------------------ --------------------- ------------------------------ SYSTEM 1 /u01/app/oracle/oradata/userdata/system01.dbf SYSTEM READ WRITE UNDOTBS1 2 /u01/app/oracle/oradata/userdata/undotbs01.dbf ONLINE READ WRITE SYSAUX 3 /u01/app/oracle/oradata/userdata/sysaux01.dbf ONLINE READ WRITE USERS 4 /u01/app/oracle/oradata/userdata/users01.dbf ONLINE READ WRITE EXAMPLE 5 /u01/app/oracle/oradata/userdata/example01.dbf ONLINE READ WRITE?將users表空間設(shè)置為只讀,嘗試修改只讀的表空間
SYS@userdata>column file_name format a60 SYS@userdata>column tablespace_name format a20 SYS@userdata>alter tablespace users read only; SYS@userdata>select tablespace_name,file#,file_name,v.status,v.enabled from dba_data_files d,v$datafile v where d.file_id=v.file#;TABLESPACE_NAME FILE# FILE_NAME STATUS ENABLED -------------------- ---------- ------------------------------------------------------------ --------------------- ------------------------------ SYSTEM 1 /u01/app/oracle/oradata/userdata/system01.dbf SYSTEM READ WRITE UNDOTBS1 2 /u01/app/oracle/oradata/userdata/undotbs01.dbf ONLINE READ WRITE SYSAUX 3 /u01/app/oracle/oradata/userdata/sysaux01.dbf ONLINE READ WRITE USERS 4 /u01/app/oracle/oradata/userdata/users01.dbf ONLINE READ ONLY EXAMPLE 5 /u01/app/oracle/oradata/userdata/example01.dbf ONLINE READ WRITESYS@userdata>update scott.emp set sal=sal+1; update scott.emp set sal=sal+1* ERROR at line 1: ORA-00372: file 4 cannot be modified at this time ORA-01110: data file 4: '/u01/app/oracle/oradata/userdata/users01.dbf'
?將表空間重新設(shè)置為只讀
SYS@userdata>alter tablespace users read write;?2.表空間脫機(jī)
SYS@userdata>alter tablespace users offline;Tablespace altered.SYS@userdata>select tablespace_name,file#,file_name,v.status,v.enabled from dba_data_files d,v$datafile v where d.file_id=v.file#;TABLESPACE_NAME FILE# FILE_NAME STATUS ENABLED -------------------- ---------- ------------------------------------------------------------ --------------------- ------------------------------ SYSTEM 1 /u01/app/oracle/oradata/userdata/system01.dbf SYSTEM READ WRITE UNDOTBS1 2 /u01/app/oracle/oradata/userdata/undotbs01.dbf ONLINE READ WRITE SYSAUX 3 /u01/app/oracle/oradata/userdata/sysaux01.dbf ONLINE READ WRITE USERS 4 /u01/app/oracle/oradata/userdata/users01.dbf OFFLINE DISABLED EXAMPLE 5 /u01/app/oracle/oradata/userdata/example01.dbf ONLINE READ WRITE SYS@userdata>update scott.emp set sal=sal+1; update scott.emp set sal=sal+1* ERROR at line 1: ORA-00376: file 4 cannot be read at this time ORA-01110: data file 4: '/u01/app/oracle/oradata/userdata/users01.dbf'SYS@userdata>alter tablespace users online;Tablespace altered.?
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/ilifeilong/p/7589382.html
總結(jié)
以上是生活随笔為你收集整理的Oracle表空间状态的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mybatis中的智能标签之二
- 下一篇: 计蒜客NOIP模拟赛4 D2T2 跑步爱