在12c中,Oracle ASM通过将密码文件存储在磁盘组里面
ASM密码文件默认存储在OCR磁盘组中,DB密码文件存储在数据文件所在磁盘组,可以通过手动修改密码文件所在磁盘组
[root@rac1 ~]# /u01/app/12.2.0/grid/bin/srvctl modify asm -pwfile '+DATA/orapwASM'
2.3 创建密码文件
- ASM 密码文件
orapwd file=’+data/ASM/orapwasm’ asm=y- 数据库密码文件
orapwd file=’+data/ORCL/orapwdb’ dbuniquename=‘cndba’- 通过之前版本的密码文件,在磁盘组中创建新的密码文件
orapwd input_file=’/oraclegrid/dbs/orapwasm’ file=’+data/ASM/orapwasm’ asm=y
检查主库节点1的dbs下没有密码文件,所以需先从asm中拷贝出来:
/oracle/app/oracle/product/19c/dbhome_1/dbs/
注意密码文件格式orapwcisdb1
从主库节点1拷贝密码文件到备库节点1的db home的dbs目录下:
[root@rac1 ~]# su - grid
Last login: Tue Nov 19 11:55:37 CST 2019
[grid@rac1 ~]$ asmcmd
ASMCMD> pwcopy pwdcisdb.256.1024323395 /oracle/app/grid/orapwcisdb1
copying +data/cisdb/PASSWORD/pwdcisdb.256.1024323395 -> /oracle/app/grid/orapwcisdb1
[root@rac1 ~]# cp /oracle/app/grid/pwdcisdb /oracle/app/oracle/product/19c/dbhome_1/dbs/orapwcisdb1
[root@rac1 ~]# chown oracle:oinstall /oracle/app/oracle/product/19c/dbhome_1/dbs/orapwcisdb1
[root@rac1 ~]# su - oracle
Last login: Tue Nov 19 11:02:12 CST 2019 on pts/0
[oracle@rac1 ~]$ scp /oracle/app/oracle/product/19c/dbhome_1/dbs/orapwcisdb1 dgrac1:/oracle/app/oracle/product/19c/dbhome_1/dbs/
The authenticity of host 'dgrac1 (192.168.52.160)' can't be established.
ECDSA key fingerprint is SHA256:xpJNeZwdOi6mRKZkQOaAL0N+tViUh1GuZlBDhnLYelg.
ECDSA key fingerprint is MD5:9c:74:bd:93:4b:26:f6:dc:6d:69:a0:2e:c6:2a:23:be.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'dgrac1,192.168.52.160' (ECDSA) to the list of known hosts.
oracle@dgrac1's password:
Permission denied, please try again.
oracle@dgrac1's password:
orapwcisdb1
再拷贝一份到备库节点2:
scp /oracle/app/oracle/product/19c/dbhome_1/dbs/orapwcisdb1 dgrac1:/oracle/app/oracle/product/19c/dbhome_1/dbs/orapwcisdb2
注意:如果密码文件没有,或格式不对,那么测试联通性的时候报错如下:
[oracle@dgrac1 dbs]$ sqlplus sys/oracle@std as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Nov 19 12:00:29 2019
Version 19.5.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-01017: ???/????; ?????
Enter user-name: ^C
拷贝密码文件到asm中管理:
[root@dgrac1 ~]# su - grid
Last login: Tue Nov 19 13:48:06 CST 2019
[grid@dgrac1 ~]$ asmcmd
ASMCMD> mkdir password
ASMCMD> pwcopy /oracle/app/oracle/product/19c/dbhome_1/dbs/orapwcisdb1 +data/cisdb/password/orapwcisdb
copying /oracle/app/oracle/product/19c/dbhome_1/dbs/orapwcisdb1 -> +data/cisdb/password/orapwcisdb
ASMCMD> cd password
ASMCMD> ls
orapwcisdb
ASMCMD> ls -l
Type Redund Striped Time Sys Name
PASSWORD UNPROT COARSE NOV 19 13:00:00 N orapwcisdb => +DATA/DB_UNKNOWN/PASSWORD/pwddb_unknown.275.1024753997
ASMCMD> pwcopy /oracle/app/oracle/product/19c/dbhome_1/dbs/orapwcisdb1 +data/cisdb/password/pwdcisdb
copying /oracle/app/oracle/product/19c/dbhome_1/dbs/orapwcisdb1 -> +data/cisdb/password/pwdcisdb
ASMCMD> ls -l
Type Redund Striped Time Sys Name
PASSWORD UNPROT COARSE NOV 19 13:00:00 N orapwcisdb => +DATA/DB_UNKNOWN/PASSWORD/pwddb_unknown.275.1024753997
PASSWORD UNPROT COARSE NOV 19 13:00:00 N pwdcisdb => +DATA/DB_UNKNOWN/PASSWORD/pwddb_unknown.276.1024754077
ASMCMD> rm +data/cisdb/password/pwdcisdb
在备库节点1使用oracle用户操作:
[oracle@dgrac1 ~]$ srvctl add database -db cisdbdg -dbname cisdb -oraclehome /oracle/app/oracle/product/19c/dbhome_1 -dbtype RAC -role PHYSICAL_STANDBY
[oracle@dgrac1 ~]$
[oracle@dgrac1 ~]$ srvctl add instance -db cisdbdg -instance cisdb1 -node dgrac1
[oracle@dgrac1 ~]$ srvctl add instance -db cisdbdg -instance cisdb2 -node dgrac2
[oracle@dgrac1 ~]$ srvctl modify database -db cisdbdg -spfile '+data/cisdb/PARAMETERFILE/spfile.274.1024752989' -pwfile '+data/cisdb/password/orapwcisdb'
[oracle@dgrac1 ~]$ srvctl modify database -db cisdb -diskgroup DATA
如果多个磁盘组,用逗号隔开。