目录
一、首先更改sid
1.1、登录数据库查看先前的sid,总共三步
1.2、关闭数据库
1.3、编辑/etc/oratab文件,把所有orcl换成dbnms
1.4、更改oracle用户的 .bash_profile文件
1.5、使改好的.bash_profile文件生效
1.6、查看系统环境变量
1.7、进入$ORACLE_HOME/dbs查看目录,看那些有orcl
1.8、更改文件名orcr>> aml,ORCL>>aml,命令如下:
1.9、重行生成密码文件,并查看
1.10、登录数据库,并查看实例名字,结果表明sid已由orcl变成aml了
二、更改数据库名dbname
2.1 备份控制文件
2.2关闭并退出数据库
2.3 查找控制文件
2.5 复制修改
2.6 编辑修改复的控制文件
2.7 目录更改,这里和oracle 10g不一样,要注意。
2.8 修改原控制文件。
2.11 查看结果
Oracle11g更改sid和dbname分为两个阶段:

第一阶段改sid,第二阶段改dbname

下面描述详细步骤

一、首先更改sid

1.1、登录数据库查看先前的sid,总共三步

[oracle@localhost ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 9 05:53:08 2013Copyright (c) 1982, 2009, Oracle.  All rights reserved.Connected to an idle instance.SQL> startup
ORACLE instance started.  Total System Global Area  539848704 bytes
Fixed Size                  1337748 bytes
Variable Size             360711788 bytes
Database Buffers          171966464 bytes
Redo Buffers                5832704 bytes
Database mounted.
Database opened.
SQL> select instance_name from v$instance;  INSTANCE
--------------------------------------------------------------------------------
orcl
SQL> view plaincopyprint?

1.2、关闭数据库

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

1.3、编辑/etc/oratab文件,把所有orcl换成dbnms

[oracle@localhost ~]$ vim /etc/oratab

1.4、更改oracle用户的 .bash_profile文件

 [oracle@localhost ~]$ vim .bash_profile:%s/oral/aml/g

1.5、使改好的.bash_profile文件生效

[oracle@localhost ~]$ .bash_profile

1.6、查看系统环境变量

[oracle@localhost ~]$ env |grep ORACLE
ORACLE_SID=aml
ORACLE_BASE=/home/oracle/app
ORACLE_HOME=/home/oracle/app/oracle

效果生成。
1.7、进入$ORACLE_HOME/dbs查看目录,看那些有orcl

[oracle@localhost ~]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ ll
total 64
-rw-rw---- 1 oracle oinstall 1544 Jun 29 00:35 hc_DBUA0.dat
-rw-rw---- 1 oracle oinstall 1544 Aug  9 05:56 hc_aml.dat
-rw-r--r-- 1 oracle oinstall 2851 May 15  2009 init.ora
-rw-r----- 1 oracle oinstall   24 Aug  8 06:46 lkHXY
-rw-r----- 1 oracle oinstall   24 Jun 29 00:47 lkaml
-rw-r----- 1 oracle oinstall 2048 Aug  9 06:09 orapwaml
drwx------ 2 oracle oinstall 4096 Jun 28 22:50 peshm_DBUA0_0
drwx------ 2 oracle oinstall 4096 Aug  8 06:45 peshm_hxy_0
drwx------ 2 oracle oinstall 4096 Jun 28 23:02 peshm_aml_0
-rw-r----- 1 oracle oinstall 3584 Aug  9 05:53 spfileaml.ora

1.8、更改文件名orcr>> aml,ORCL>>aml,命令如下:

[oracle@localhost dbs]$ mv hc_orcl.dat hc_aml.dat
[oracle@localhost dbs]$ mv orapworcl orapwaml
[oracle@localhost dbs]$ mv lkORCL lkaml
[oracle@localhost dbs]$ mv peshm_orcl_0/ peshm_aml_0/
[oracle@localhost dbs]$ mv spfileorcl.ora spfileaml.ora

1.9、重行生成密码文件,并查看
注意最好把原来的删除掉(或者改名备份)

[oracle@localhost dbs]$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=sys entries=5 force=y
[oracle@localhost dbs]$ ls -lrt orap*
-rw-r----- 1 oracle oinstall 2048 Aug  9 06:09 orapwaml

1.10、登录数据库,并查看实例名字,结果表明sid已由orcl变成aml了

[oracle@localhost dbs]$ sqlplus "/as sysdba"Connected to an idle instance.  SQL> startup
ORACLE instance started.  Total System Global Area  539848704 bytes
Fixed Size                  1337748 bytes
Variable Size             327157356 bytes
Database Buffers          205520896 bytes
Redo Buffers                5832704 bytes
Database mounted.
Database opened.
SQL> select instance from v$thread;INSTANCE
--------------------------------------------------------------------------------
aml

二、更改数据库名dbname

2.1 备份控制文件

SQL>  alter database backup controlfile to trace resetlogs;
Database altered.

2.2关闭并退出数据库

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

2.3 查找控制文件
orcale 11.2g的控制文件的备份目录为

/home/oracle/app/oracle/diag/rdbms/aml/aml/trace

[oracle@localhost trace]$ ls -lrt
[oracle@mazh dbs]$ ls /home/oracle/app/oracle/diag/rdbms/aml/aml/trace -lrth
total 116K
-rw-r----- 1 oracle oinstall  259 Aug  8 06:45 aml_ora_4808.trm
-rw-r----- 1 oracle oinstall  15K Aug  8 06:45 aml_ora_4808.trc
-rw-r----- 1 oracle oinstall   57 Aug  8 06:46 aml_mman_4845.trm
-rw-r----- 1 oracle oinstall  796 Aug  8 06:46 aml_mman_4845.trc
-rw-r----- 1 oracle oinstall   57 Aug  8 06:46 aml_dbrm_4839.trm
-rw-r----- 1 oracle oinstall  839 Aug  8 06:46 aml_dbrm_4839.trc
-rw-r----- 1 oracle oinstall   57 Aug  8 06:46 aml_mmon_4857.trm
-rw-r----- 1 oracle oinstall  833 Aug  8 06:46 aml_mmon_4857.trc
-rw-r----- 1 oracle oinstall   67 Aug  8 06:46 aml_j004_4909.trm
-rw-r----- 1 oracle oinstall  912 Aug  8 06:46 aml_j004_4909.trc
-rw-r----- 1 oracle oinstall  112 Aug  8 06:47 aml_j000_4900.trm
-rw-r----- 1 oracle oinstall 2.8K Aug  8 06:47 aml_j000_4900.trc
-rw-r----- 1 oracle oinstall   67 Aug  8 06:58 aml_ckpt_4851.trm
-rw-r----- 1 oracle oinstall  905 Aug  8 06:58 aml_ckpt_4851.trc
-rw-r----- 1 oracle oinstall   78 Aug  8 06:58 aml_j000_5233.trm
-rw-r----- 1 oracle oinstall 1.8K Aug  8 06:58 aml_j000_5233.trc
-rw-r----- 1 oracle oinstall   57 Aug  8 08:04 aml_j000_7066.trm
-rw-r----- 1 oracle oinstall 1.1K Aug  8 08:04 aml_j000_7066.trc
-rw-r----- 1 oracle oinstall  139 Aug  8 08:43 aml_vktm_4831.trm
-rw-r----- 1 oracle oinstall 1.9K Aug  8 08:43 aml_vktm_4831.trc
-rw-r----- 1 oracle oinstall  407 Aug  8 08:43 aml_ora_4871.trm
-rw-r----- 1 oracle oinstall 6.3K Aug  8 08:43 aml_ora_4871.trc
-rw-r----- 1 oracle oinstall 6.2K Aug  8 08:43 alert_aml.log
[oracle@localhost trace]$ vim alert_aml.log

可以在 alter_aml.log里找到contolfile的备份trc,sid_ora_nnnn.trc 最新的一个就是。

alter_aml.log里面有这样一行字样,告诉你哪个是控制备份文件

Backup controlfile written to trace file /home/oracle/app/oracle/diag/rdbms/orcl/aml/trace/aml_ora_4871.trc

2.5 复制修改

[oracle@localhost trace]$ cp aml_ora_4871.trc aml.sql

2.6 编辑修改复的控制文件
aml.sql,也就是aml_ora_4871.trc的复制品。

1)查找STARTUP NOMOUNT语句,将这一行上面的所有行都删除

2)查找所有以–开始的行,把这些行删除

3)查找所有的orcl修改为aml,所有的ORCL修改为aml

4)找到CREATE CONTROLFILE REUSE DATABASE…语句,将其中的REUSE修改为SET

5)找到RECOVER DATABASE USING BACKUP CONTROLFILE语句,将其用双横线(–)注释掉

结果如下:

[oracle@mazh dbs]$ cat /home/oracle/app/oracle/diag/rdbms/aml/aml/trace/aml.sql
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "aml" RESETLOGS  NOARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100MAXINSTANCES 8MAXLOGHISTORY 292
LOGFILEGROUP 1 '/home/oracle/app/oracle/oradata/aml/redo01.log'  SIZE 50M BLOCKSIZE 512,GROUP 2 '/home/oracle/app/oracle/oradata/aml/redo02.log'  SIZE 50M BLOCKSIZE 512,GROUP 3 '/home/oracle/app/oracle/oradata/aml/redo03.log'  SIZE 50M BLOCKSIZE 512
DATAFILE'/home/oracle/app/oracle/oradata/aml/system01.dbf','/home/oracle/app/oracle/oradata/aml/sysaux01.dbf','/home/oracle/app/oracle/oradata/aml/undotbs01.dbf','/home/oracle/app/oracle/oradata/aml/users01.dbf','/home/oracle/app/oracle/oradata/aml/example01.dbf'
CHARACTER SET AL32UTF8;--RECOVER DATABASE USING BACKUP CONTROLFILE
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE '/home/oracle/app/oracle/oradata/aml/temp01.dbf'SIZE 30408704  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

2.7 目录更改,这里和oracle 10g不一样,要注意。

[sql] view plaincopyprint
[oracle@localhost ~]$ cd /home/oracle/app/oracle/
[oracle@localhost oracle]$ ls
admin  cfgtoollogs  checkpoints  diag  flash_recovery_area  oradata  product
[oracle@localhost oracle]$ cd flash_recovery_area/
[oracle@localhost flash_recovery_area]$ ls
orcl  ORCL
[oracle@localhost flash_recovery_area]$ mv orcl/ aml/
[oracle@localhost flash_recovery_area]$ mv ORCL/ aml/
[oracle@localhost flash_recovery_area]$ cd ..
[oracle@localhost oracle]$ ls
admin  cfgtoollogs  checkpoints  diag  flash_recovery_area  oradata  product
[oracle@localhost oracle]$ cd oradata/
[oracle@localhost oradata]$ ls
orcl
[oracle@localhost oradata]$ mv orcl/ aml/
[oracle@localhost oradata]$ ls
aml
[oracle@localhost oradata]$ cd ..
[oracle@localhost oracle]$ ls
admin  cfgtoollogs  checkpoints  diag  flash_recovery_area  oradata  product
[oracle@localhost oracle]$ cd diag/
[oracle@localhost diag]$ ls
rdbms  tnslsnr
[oracle@localhost diag]$ cd rdbms/
[oracle@localhost rdbms]$ ls
orcl
[oracle@localhost rdbms]$ mv orcl/ aml/
[oracle@localhost rdbms]$ ls
aml
[oracle@localhost rdbms]$ cd aml
[oracle@localhost aml]$ ls
i_1.mif  aml
[oracle@localhost aml]$ cd ..
[oracle@localhost rdbms]$ cd ..
[oracle@localhost diag]$ ls
rdbms  tnslsnr
[oracle@localhost diag]$ cd ..
[oracle@localhost oracle]$ cd admin/
[oracle@localhost admin]$ ls
orcl
[oracle@localhost admin]$ cd orcl/
[oracle@localhost orcl]$ ls
adump  dpdump  pfile
[oracle@localhost orcl]$ cd ..
[oracle@localhost admin]$ mv orcl/ aml/
[oracle@localhost admin]$ ls
aml
[oracle@localhost admin]$ sqlplus / as sysdba  Connected to an idle instance.  SQL>

2.8 修改原控制文件。

[oracle@localhost oradata]# cd aml/
[oracle@localhostaml]#ls
control01.ctl redo01.log redo03.log system01.dbf undotbs01.dbf
example01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf
[oracle@localhost aml]#mv control01.ctl control01.ctl.aaa
[oracle@localhostaml]#ls
control01.ctl.aaa redo01.log redo03.log system01.dbf undotbs01.dbf
example01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf
[oracle@localhost aml]#cd ..
[oracle@localhost oradata]# ls
aml
[oracle@localhost oradata]#cd ..
[oracle@localhost oracle] ls
admin cfgtoollogs checkpoints diag flash_recovery_area oradata product
[oracle@localhost oracle]#cd flash_recovery_area/
[oracle@localhost flash_recovery_area]#ls
aml aml
[oracle@localhost flash_recovery_area]#cd aml/
[oracle@localhost aml]# ls
control02.ctl
[oracle@localhost aml]#mv control02.ctl control02.ctl.aaa

2.9 登录oracle重新生成spfile文件

[oracle@localhost aml]$ sqlplus / as sysdbaConnected to an idle instance.SQL> create spfile from pfile='?/dbs/initaml.ora';File created.

2.10 调用前面步骤修改好的aml.sql,目的是生成链接控制文件等

SQL> @/home/oracle/app/oracle/diag/rdbms/aml/aml/trace/aml.sql
ORACLE instance started.  Total System Global Area  539848704 bytes
Fixed Size                  1337748 bytes
Variable Size             327157356 bytes
Database Buffers          205520896 bytes
Redo Buffers                5832704 bytes  Control file created.
Database altered.
Tablespace altered.

2.11 查看结果

SQL> select open_mode from v$database;  OPEN_MODE
--------------------
READ WRITE  SQL> show parameter name  NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      aml
db_unique_name                       string      aml
global_names                         boolean     FALSE
instance_name                        string      aml
lock_name_space                      string
log_file_name_convert                string
service_names                        string      aml.localdomain
SQL> select name from v$database;  NAME
---------
aml  SQL>

有个小插曲在SQL> @/home/oracle/app/oracle/diag/rdbms/aml/aml/trace/aml.sql 时报错如下:

[oracle@mazh trace]$  sqlplus "/as sysdba"SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 9 09:03:56 2013Copyright (c) 1982, 2009, Oracle.  All rights reserved.ERROR:
ORA-09925: Unable to create audit trail file
Linux Error: 2: No such file or directory
Additional information: 9925
ORA-01075: you are currently logged onEnter user-name:
ERROR:
ORA-01017: invalid username/password; logon deniedEnter user-name:
ERROR:
ORA-01017: invalid username/password; logon deniedSP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@mazh trace]$ ps -ef|grep smo
root       470     7  0 07:10 ?        00:00:00 [kpsmoused]
oracle    5236     1  0 09:01 ?        00:00:00 ora_smon_aml
oracle    5263  5047  0 09:04 pts/2    00:00:00 grep smo
[oracle@mazh trace]$ kill -9 5236
[oracle@mazh trace]$ ps -ef|grep smo
root       470     7  0 07:10 ?        00:00:00 [kpsmoused]
oracle    5265  5047  0 09:04 pts/2    00:00:00 grep smo
[oracle@mazh trace]$  sqlplus "/as sysdba"SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 9 09:04:36 2013Copyright (c) 1982, 2009, Oracle.  All rights reserved.Connected to an idle instance.
SQL> @aml1.sql
ORA-09925: Unable to create audit trail file
Linux Error: 2: No such file or directory
Additional information: 9925
CREATE CONTROLFILE SET DATABASE "aml" RESETLOGS  NOARCHIVELOG
*
ERROR at line 1:
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0ALTER DATABASE OPEN RESETLOGS
*
ERROR at line 1:
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0ALTER TABLESPACE TEMP ADD TEMPFILE '/home/oracle/app/oracle/oradata/aml/temp01.dbf'
*
ERROR at line 1:
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0

在网上找了各种方法都不行,后来发现是

/home/oracle/app/oracle/dbs/initaml.ora里的参数竟然捣的鬼

以下什么原因导致的还不是很清楚,请各位高手给与指点下。

[oracle@mazh trace]$ vi /home/oracle/app/oracle/dbs/initaml.ora orcl.__db_cache_size=83886080
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__oracle_base='/home/oracle/app'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=79691776
orcl.__sga_target=239075328
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=138412032
orcl.__streams_pool_size=4194304
aml.__db_cache_size=83886080
aml.__java_pool_size=4194304
aml.__large_pool_size=4194304
aml.__oracle_base='/home/oracle/app'#ORACLE_BASE set from environment
aml.__pga_aggregate_target=79691776
aml.__sga_target=239075328
aml.__shared_io_pool_size=0
aml.__shared_pool_size=109051904
aml.__streams_pool_size=0
*.audit_file_dest='/home/oracle/app/admin/aml/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/home/oracle/app/oracle/oradata/aml/control01.ctl','/home/oracle/app/flash_recovery_area/aml/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='aml'
*.db_recovery_file_dest='/home/oracle/app/flash_recovery_area'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/home/oracle/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=amlXDB)'
*.open_cursors=300
*.pga_aggregate_target=78643200
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=235929600
*.timed_statistics=TRUE
*.undo_tablespace='UNDOTBS1'

oracle 11g 更改sid和dbname相关推荐

  1. oracle 11查询sid,oracle 11g 更改sid和dbname

    分两个阶段描述,第一阶段改sid,第二阶段改dbname 下面描述详细步骤 首先要更改sid 1.登录数据库查看先前的sid,总共三步 [oracle@localhost ~]$ sqlplus &q ...

  2. oracle 日志的容量,oracle 11g 更改日志组大小

    oracle 11g 更改日志组大小 1.创建新的日志组 1.alter database add logfile group 4 ('/u01/app/oracle/oradata/jian/red ...

  3. 安装oracle11g 选择什么字符集,oracle 11g 更改字符集

    工作需要,安装装了oracle 11g,在导入其他机器上的备份数据的时间,发生一个错误: IMP-00019: 由于 ORACLE 错误 12899 而拒绝行 IMP-00003: 遇到 ORACLE ...

  4. Linux 下 Oracle 11g 更改默认端口号

    文章目录 查看当前端口信息 进入 oracle 用户 进入 oracle 服务 启动 oracle 服务 查看配置 修改远程端口 更改 oracle 配置 更改 listener.ora 更改 tns ...

  5. mysql al32utf8_Oracle 11g更改字符集AL32UTF8为ZHS16GBK

    Oracle 9i更改字符集AL32UTF8为ZHS16GBKSQLgt; conn /as sysdba SQLgt; shutdown immediate; SQLgt; startup moun ...

  6. Oracle 11g业务用户更改密码后产生大量library cache lock等待

    DB Version:11.2.0.4+RAC OS Version:Oracle Linux Server 6.7 在我的一个两节点RAC数据库上,alert日志中平均每3秒左右就会产生一条连接超时 ...

  7. 更改Oracle数据库的SID

    更改Oracle数据库的SID 转载自 james_yulei 最终编辑 james_yulei 概念:     SID : 数据库实例名 SQL> show parameter instanc ...

  8. oracle 11g 的em启动不了

    前几天抽了个时间,在测试的服务器上,安装一个ERP系统的模拟环境. 在安装ORACLE的过程中,遇到了ORACLE的EM无法访问,今天折腾了一个早上,终于解决了. 症状:刚装完ORACLE 11G后, ...

  9. oracle无法重建em,ORACLE 11g, EM 无法启动的问题和重建

    ORACLE 11g, EM 无法启动的问题,可能是IP更改了的原因,所以我使用了EMCA命令重新配置了一下ORACLE EM,具体过程如下: I:\Documents and Settings\ge ...

最新文章

  1. 十二步创建你的第一个JavaScript库
  2. 带你看懂LayoutInflater中inflate方法
  3. 虚拟与现实的距离——VR的2016正如移动互联网的2009【下篇】
  4. 企业绩效管理系统之平衡记分卡
  5. oracle+11g+rda,Oracle RDA 4.20 初体验
  6. Wannafly挑战赛17
  7. OGNL与Struts2标签展示页面(一)
  8. C语言课后习题(29)
  9. MyBatis学习总结(3)——优化MyBatis配置文件中的配置
  10. unity 制作书本 翻页效果
  11. 【网络信息安全】网络信息安全概述
  12. pdf 目录导入 macos
  13. SpringBoot非官方教程 | 终章:文章汇总(转载https://blog.csdn.net/forezp/article/details/70341818 本文出自方志朋的博客)
  14. 小白共享网盘系统源码V5.0
  15. niosii 把程序固化到epcs中的步骤
  16. sort 自定义排序使用方法
  17. A-瑞神的序列 B- 消消乐大师-Q老师(M3)
  18. Error occured processing XML 'Cannot find class [springmvc.extention.BeanArgumentResolver]
  19. Maven依赖版本号不生效
  20. idea 如何引入WEB-INF下lib中的jar包

热门文章

  1. java利用redis的setIfAbsent和incr,实现自增,限制总数
  2. java:对字母进行大写(小写)的转化
  3. java.time.ZoneId类详解
  4. 访问者模式(Visitor模式)
  5. 工行二维码支付接口及回调接口
  6. 日常问题解决:Linux磁盘扩容
  7. Mysql 正则 实现 like in 效果
  8. 通过开源工具XCA工具签发和管理可被浏览器信任的SSL证书
  9. qt下使用opencascade源代码
  10. 官方发布!2021下半年二建考试报名注意事项!