• Oracle数据文件改名


    1. open状态改名

    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
    
    SYS@userdata>
    SYS@userdata>alter tablespace users offline;
    
    Tablespace altered.
    
    SYS@userdata>host cp /u01/app/oracle/oradata/userdata/users01.dbf /u01/app/oracle/oradata/userdata/users02.dbf
    
    SYS@userdata>alter database rename file '/u01/app/oracle/oradata/userdata/users01.dbf' to '/u01/app/oracle/oradata/userdata/users02.dbf';
    
    Database altered.
    
    SYS@userdata>alter tablespace users online;
    
    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/users02.dbf               ONLINE                READ WRITE
    EXAMPLE                 5     /u01/app/oracle/oradata/userdata/example01.dbf               ONLINE               READ WRITE

     2. mount状态改名

    SYS@userdata>select open_mode from v$database;
    
    OPEN_MODE
    ------------------------------
    MOUNTED
    
    SYS@userdata>host cp /u01/app/oracle/oradata/userdata/users02.dbf /u01/app/oracle/oradata/userdata/users01.dbf
    
    SYS@userdata>alter database rename file '/u01/app/oracle/oradata/userdata/users02.dbf' to '/u01/app/oracle/oradata/userdata/users01.dbf';
    
    Database altered.
    
    SYS@userdata>alter database open;
    
    Database 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               ONLINE                READ WRITE
    EXAMPLE                 5     /u01/app/oracle/oradata/userdata/example01.dbf               ONLINE               READ WRITE
  • 相关阅读:
    毕业了,少感慨,多努力
    NHibernate初学者指南(19):验证复杂业务规则
    从DataSet导出Txt
    NHibernate初学者指南(20):开发中常见的错误(一)
    高级Linux程序设计第三章:进程
    有关Lucene的问题(5):Lucene中的TooManyClause异常
    Lucene学习总结之九:Lucene的查询对象(3)
    高级Linux程序设计第二章:编写良好的Linux软件
    Lucene学习总结之八:Lucene的查询语法,JavaCC及QueryParser(1)
    Lucene学习总结之八:Lucene的查询语法,JavaCC及QueryParser(2)
  • 原文地址:https://www.cnblogs.com/ilifeilong/p/7589545.html
Copyright © 2020-2023  润新知