zoukankan      html  css  js  c++  java
  • 【Oracle】重命名数据文件

    1)查看当前数据文件位置

    SQL> select file_id,file_name,tablespace_name from dba_data_files;


       FILE_ID FILE_NAME                                          TABLESPACE_NAME
    ---------- -------------------------------------------------- ------------------------------
             4 /u01/app/oracle/oradata/drz/users01.dbf            USERS
             3 /u01/app/oracle/oradata/drz/undotbs01.dbf          UNDOTBS1
             2 /u01/app/oracle/oradata/drz/sysaux01.dbf           SYSAUX
             1 /u01/app/oracle/oradata/drz/system01.dbf           SYSTEM

             5 /u01/app/oracle/oradata/drz/example01.dbf          EXAMPLE


    2)一致性关闭数据库

    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> 
    SQL> 
    SQL> exit                                                                                  
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options


    3)操作系统中修改数据文件的名称

    [oracle@lgr ~]$ mv /u01/app/oracle/oradata/drz/users01.dbf /u01/app/oracle/oradata/drz/users01a.dbf


    4)启动数据库到mount状态

    [oracle@lgr ~]$ sqlplus / as sysdba


    SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 16 12:18:57 2017


    Copyright (c) 1982, 2013, Oracle.  All rights reserved.


    Connected to an idle instance.


    SQL> startup mount;
    ORACLE instance started.


    Total System Global Area  521936896 bytes
    Fixed Size                  2254824 bytes
    Variable Size             209717272 bytes
    Database Buffers          301989888 bytes
    Redo Buffers                7974912 bytes
    Database mounted.


    5)数据库中修改数据文件的名称,并打开数据库

    SQL> alter database rename file '/u01/app/oracle/oradata/drz/users01.dbf' to '/u01/app/oracle/oradata/drz/users01a.dbf';     


    Database altered.


    6)验证修改后的结果

    SQL> select file_id,file_name,tablespace_name from dba_data_files;

    FILE_ID FILE_NAME                                          TABLESPACE_NAME
    ---------- -------------------------------------------------- ------------------------------
             4 /u01/app/oracle/oradata/drz/users01a.dbf            USERS
             3 /u01/app/oracle/oradata/drz/undotbs01.dbf          UNDOTBS1
             2 /u01/app/oracle/oradata/drz/sysaux01.dbf           SYSAUX
             1 /u01/app/oracle/oradata/drz/system01.dbf           SYSTEM
             5 /u01/app/oracle/oradata/drz/example01.dbf          EXAMPLE

  • 相关阅读:
    我的第一篇博客,简单介绍MarkDown的语法。
    js实现网页pdf打印
    spring与hibernate整合入门-----示例一:各自为政【第一天】
    思考记录
    hibernate入门---Hibernate查询方式(for循环、构造器、对象数组等)【第三天,相当于总结整合】
    hibernate入门---uuid.hex生成方式【依据机器标识等自生】【第二天】
    hibernate入门-------实例、increment生成方式【实例自增-避免使用】【第二天】
    Hibernate入门----几种主键ID生成方式及示例【第二天】
    bat入门-----attrib隐藏文件【第一天】
    bat入门-----依据ping状态判断ip【第一天】
  • 原文地址:https://www.cnblogs.com/NextAction/p/7366631.html
Copyright © 2011-2022 走看看