Linux 设置oracle的sid,Oracle修改实例名SID

修改

1、检查原来的数据库实例名

$ echo $ORACLE_SID
orcl
$ sqlplus / as sysdba
> select instance from v$thread;
INSTANCE
orcl

2、关闭数据库

> shutdown immediate;
> exit;

3、修改oracle用户的ORACLE_SID环境变量,如由orcl修改为linux

$ vi /home/oracle/.bash_profile
export ORACLE_SID=linux
$ source /home/oracle/.bash_profile

4、修改/etc/oratab文件,将sid名由orcl修改为linux

$ vi /etc/oratab
linux:/u01/app/oracle/11.2/db_1:Y

5、进入到$ORACLE_HOME/dbs目录

将所有文件名中包含原来的sid的修改为对应的新sid的

$ cd $ORACLE_HOME/dbs
$ mv hc_zf.dat hc_linux.dat
$ mv lkZF lklinux
$ mv orapwzf orapwlinux
$ mv spfilezf.ora spfilelinux.ora

6、重建口令文件(高版本会报错,解决见后面)

因为口令文件改名后不能在新实例中使用,所以重建

$ orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=123456 entries=5 force=y

7、启动数据库

$ sqlplus / as sysdba
> startup

8、检查数据库实例名

通过如下语句检查数据库实例名,发现实例名已经由orcl变成linux

> select instance from v$thread;
INSTANCE
linux

这个时候虽然实例名字已经改成linux,但是数据库名(dbname)仍然为orcl,因此在客户端仍旧无法连接,如需要连接,则需修改dbname。

报错解决

【密码文件】Oracle 18c orapwd 命令 OPW-00029: Password complexity failed

18c创建密码文件报错:

OPW-00029: Password complexity failed for SYS user : Password must contain at least 8 characters.

解决:

$ orapwd file=orapwrac18cphy password=lhr format=12 force=y;

参考

当忘记sys口令的时候,可以使用orapwd命令重建口令文件。但是在Oracle 18c中却会报OPW-00029的错误。

[oracle@]$ sqlplus -version
SQL*Plus: Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
[oracle@]$ orapwd file=/u01/app/oracle/product/18.3.0/db_1/dbs/orapwcndba password='oracle'  
OPW-00029: Password complexity failed for SYS user : Password must contain at least 8 characters.
[oracle@]$

这是因为Oracle 增强了密码验证函数:ora12c_verify_function

The ora12c_verify_function function fulfills the Department of Defense Database Security Technical Implementation Guiderequirements. This function checks for the following requirements when users create or modify passwords:     The password contains no fewer than 8 characters and includes at least one numeric and one alphabetic character.     The password is not the same as the user name or the user name reversed.     The password is not the same as the database name.     The password does not contain the word oracle (such as oracle123).     The password differs from the previous password by at least 8 characters.     The password contains at least 1 special character.

所以解决方法有两种:

1. 指定符合验证函数的密码

[oracle@]$ orapwd file=/u01/app/oracle/product/18.3.0/db_1/dbs/orapwcndba password='$
[oracle@]$

2. 在orapwd命令中指定format到12.2 之前的版本。 该参数默认是12.2. 根据命令帮助,将format指定为12即可。

[oracle@]$ orapwd file=/u01/app/oracle/product/18.3.0/db_1/dbs/orapwcndba password='oracle' format=12  
[oracle@]$

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值