zoukankan      html  css  js  c++  java
  • DBNEWNAME工具介绍

    下面修改数据库的SID和db_name

    1. [root@oracle ~]# su - ora11g
    2. db11@oracle /home/ora11g$
    3. db11@oracle  /home/ora11g$ sqlplus /as sysdba
    4. SQL*Plus:Release11.2.0.4.0Production on MonMar3007:39:362015
    5. Copyright(c)1982,2013,Oracle.All rights reserved.
    6. Connected to:
    7. OracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
    8. With the Partitioning, OLAP,DataMiningandRealApplicationTesting options
    9. SQL>select name, dbid,log_mode,open_mode from v$database;
    10. NAME DBID LOG_MODE OPEN_MODE
    11. ---------------------------------------------------
    12. DB11 1400765095 ARCHIVELOG READ WRITE

    启动到mount状态

    1. SQL> shutdown immediate;
    2. Database closed.
    3. Database dismounted.
    4. ORACLE instance shut down.
    5. SQL> startup mount
    6. ORACLE instance started.
    7. TotalSystemGlobalArea835104768 bytes
    8. FixedSize2257840 bytes
    9. VariableSize507513936 bytes
    10. DatabaseBuffers322961408 bytes
    11. RedoBuffers2371584 bytes
    12. Database mounted.
    13. SQL>exit
    14. DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
    15. With the Partitioning, OLAP,DataMiningandRealApplicationTesting options

    执行命令

    1. db11@oracle /home/ora11g$ nid target=sys/oracle dbname=newdb11 setname=yes
    2. DBNEWID:Release11.2.0.4.0-Production on MonMar3007:44:262015
    3. Copyright(c)1982,2011,Oracleand/or its affiliates.All rights reserved.
    4. Connected to database DB11 (DBID=1400765095)
    5. Connected to server version 11.2.0
    6. ControlFilesin database:
    7. /u01/app/oracle11g/oradata/DB11/controlfile/o1_mf_bcc2h7dx_.ctl
    8. Change database name of database DB11 to NEWDB11?(Y/[N])=> Y
    9. Proceedingwith operation
    10. Changing database name from DB11 to NEWDB11
    11. ControlFile/u01/app/oracle11g/oradata/DB11/controlfile/o1_mf_bcc2h7dx_.ctl - modified
    12. Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_system_bcc2dp1d_.db - wrote new name
    13. Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_sysaux_bcc2dp2c_.db - wrote new name
    14. Datafile/u01/app/oracle11g/oradata/DB11/datafile/fdstore.db - wrote new name
    15. Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_users_bcc2dp33_.db - wrote new name
    16. Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_new_user_bcp23qgn_.db - wrote new name
    17. Datafile/u01/app/oracle11g/oradata/DB11/datafile/undotbs2.db - wrote new name
    18. Datafile/u01/app/oracle11g/oradata/DB11/datafile/o1_mf_temp_bcc2hld2_.tm - wrote new name
    19. ControlFile/u01/app/oracle11g/oradata/DB11/controlfile/o1_mf_bcc2h7dx_.ctl - wrote new name
    20. Instance shut down
    21. Database name changed to NEWDB11.
    22. Modify parameter file and generate a new password file before restarting.
    23. Succesfully changed database name.
    24. DBNEWID -Completed succesfully.

    数据库中修改db_name

    1. db11@oracle /u01/app/oracle11g/product/11.2.0/dbhome_1/dbs$ sqlplus /as sysdba
    2. SQL*Plus:Release11.2.0.4.0Production on MonMar3007:58:332015
    3. Copyright(c)1982,2013,Oracle.All rights reserved.
    4. Connected to an idle instance.
    5. SQL> startup nomount
    6. ORACLE instance started.
    7. TotalSystemGlobalArea835104768 bytes
    8. FixedSize2257840 bytes
    9. VariableSize507513936 bytes
    10. DatabaseBuffers322961408 bytes
    11. RedoBuffers2371584 bytes
    12. SQL>set line 200
    13. SQL> show parameter db_name
    14. SQL> show parameter db_name
    15. NAME TYPE VALUE
    16. ----------------------------------------------------------------------------------------
    17. db_name string db11
    18. SQL> alter system set db_name=newdb11 scope=spfile;
    19. System altered.
    20. SQL> startup mount force
    21. ORACLE instance started.
    22. TotalSystemGlobalArea835104768 bytes
    23. FixedSize2257840 bytes
    24. VariableSize507513936 bytes
    25. DatabaseBuffers322961408 bytes
    26. RedoBuffers2371584 bytes
    27. Database mounted.
    28. SQL>exit
    29. DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
    30. With the Partitioning, OLAP,DataMiningandRealApplicationTesting options

    创建新的密码文件

    1. db11@oracle /home/ora11g$ 
    2. db11@oracle  /home/ora11g$ orapwd file=$ORACLE_HOME/dbs/orapwnewdb11 password=oracle entries=10
    3.  
    4. 创建参数文件
    5.  
    6. db11@oracle  /home/ora11g$ export ORACLE_SID=newdb11
    7. SQL> create spfile from pfile;
    8. File created.
    9. SQL>exit
    10. DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
    11. With the Partitioning, OLAP,DataMiningandRealApplicationTesting options
    12. 根据原参数文件,修改成新的参数文件,具体操作略

    启动新的数据库名的数据库

    1. newdb11@oracle /home/ora11g$ export ORACLE_SID=newdb11
    2. newdb11@oracle  /home/ora11g$ sqlplus /as sysdba
    3. SQL*Plus:Release11.2.0.4.0Production on MonMar3008:16:162015
    4. Copyright(c)1982,2013,Oracle.All rights reserved.
    5. Connected to:
    6. OracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction
    7. With the Partitioning, OLAP,DataMiningandRealApplicationTesting options
    8. SQL> startup
    9. ORACLE instance started.
    10. TotalSystemGlobalArea835104768 bytes
    11. FixedSize2257840 bytes
    12. VariableSize507513936 bytes
    13. DatabaseBuffers322961408 bytes
    14. RedoBuffers2371584 bytes
    15. Database mounted.
    16. Database opened.
    17. SQL>
    18. SQL>select instance_name,status from v$instance;
    19. INSTANCE_NAME STATUS
    20. ----------------------------
    21. newdb11 OPEN

    OK。。。启动成功

  • 相关阅读:
    第五课 按键控制文本
    第四课:怎么去掉Activity的标题和邮件图标-20160705
    第三课:控件的使用及按键响应-20160705
    第二课:Android Studo 各文件作用-20160705
    第一课:如何创建Android Studo 工程-20160705
    JTAG各类接口针脚定义及含义
    c# 定时器的实现
    二进制及十进制文件的读写方法
    c# 检测设备改变
    Vue(四)事件和属性
  • 原文地址:https://www.cnblogs.com/haoxiaoyu/p/5ff69c0db07eeb6e3ba5771ca69a47e6.html
Copyright © 2011-2022 走看看