• Oracle表空间状态


    1.表空间只读

    查看当前表空间状态

    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表空间设置为只读,尝试修改只读的表空间

    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 WRITE
    SYS@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'

     将表空间重新设置为只读

    SYS@userdata>alter tablespace users read write;

     2.表空间脱机

    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.

     

  • 相关阅读:
    Ubuntu12.04 亮度调节和保存
    算法
    Python一些常见问题的解决方法
    数据结构
    C# 运行时编译代码并执行 【转】
    C# 动态添加属性 非原创 有修改
    30天学通Visual C++项目案例开发 下載
    .NET常用Request获取信息
    获取一个目录下所有的文件,包括子目录的
    C++入门到精通_全集下载
  • 原文地址:https://www.cnblogs.com/ilifeilong/p/7589382.html
Copyright © 2020-2023  润新知