orapwd 修改sysdg

orapwd

[oracle@bakdb ~]$ orapwd
usage: orapwd file=<fname> force=<y /n> asm=</y><y /n>
       dbuniquename=<dbname> format=&lt;12/12.2>
       delete=<y /n> input_file=<input -fname/>
       sys=</y><y /password/external(<sys-external-name>)>
       sysbackup=</y><y /password/external(<sysbackup-external-name>)>
       sysdg=</y><y /password/external(<sysdg-external-name>)>
       syskm=</y><y /password/external(<syskm-external-name>)>
usage: orapwd describe file=<fname>
  where
    file - name of password file (required),
    password - password for sys will be prompted
               if not specified at command line.
               ignored, if input_file is specified,
    force - whether to overwrite existing file (optional),
    asm - indicates that the password to be stored in
          automatic storage management (asm) disk group
          is an asm password. (optional),
    dbuniquename - unique database name used to identify database
                   password files residing in asm diskgroup only.
                   ignored when asm option is specified (optional),
    format - use format=12 for new 12c features like sysbackup, sysdg and
             syskm support, longer identifiers, sha2 verifiers etc.
             use format=12.2 for 12.2 features like enforcing user 
             profile (password limits and password complexity) and 
             account status for administrative users.
             if not specified, format=12.2 is default (optional),
    delete - drops a password file. must specify 'asm',
             'dbuniquename' or 'file'. if 'file' is specified,
             the file must be located on an asm diskgroup (optional),
    input_file - name of input password file, from where old user
                 entries will be migrated (optional),
    sys - specifies if sys user is password or externally authenticated.
          for external sys, also specifies external name.
          sys={y/password} specifies if sys user password needs
          to be changed when used with input_file,
    sysbackup - creates sysbackup entry (optional).
                specifies if sysbackup user is password or externally
                authenticated. for external sysbackup, also specifies
                external name. ignored, if input_file is specified,
    sysdg - creates sysdg entry (optional).
            specifies if sysdg user is password or externally authenticated.
            for external sysdg, also specifies external name.
            ignored, if input_file is specified,
    syskm - creates syskm entry (optional).
            specifies if syskm user is password or externally authenticated.
            for external syskm, also specifies external name.
            ignored, if input_file is specified,
    describe - describes the properties of specified password file
               (required).
</fname></y></dbname></y></fname>

sysdg的密码存在密码文件中

sql> SET linesize 200
sql> col username FOR a20
sql> col account_status FOR a30            
sql> SELECT username,account_status FROM dba_users WHERE username='sysdg'; 
username             account_status
-------------------- ------------------------------
sysdg                expired & locked
sql>

–修改密码

sql> alter user sysdg account unlock;
user altered.
sql> alter user sysdg identified by !qaz2wsx;
alter user sysdg identified by !qaz2wsx
                                *
error at line 1:
ora-00922: missing or invalid option
sql> alter user sysdg identified by "!qaz2wsx";
user altered.
sql>

远程正常登陆

c:\users\lhongjie>sqlplus sysdg@db12c as sysdg
sql*plus: release 12.2.0.1.0 production on 星期六 7月 7 13:46:14 2018
copyright (c) 1982, 2016, oracle.  all rights reserved.
输入口令:
连接到:
oracle database 12c enterprise edition release 12.2.0.1.0 - 64bit production
sql>
sysdg修改密码,新密码sqlplus可以登陆:
sql> alter user sysdg identified by lihj2019;
user altered.
sql> 
c:\users\lhongjie>sqlplus sysdg@db12c as sysdg
sql*plus: release 12.2.0.1.0 production on 星期六 7月 7 13:49:43 2018
copyright (c) 1982, 2016, oracle.  all rights reserved.
输入口令:
连接到:
oracle database 12c enterprise edition release 12.2.0.1.0 - 64bit production
sql>
sql> set linesize 200
sql> col file_name for a50 
sql> select * from v$passwordfile_info;
file_name                                          format is_as     con_id
-------------------------------------------------- ------ ----- ----------
/u01/app/oracle/product/12.2.0/db_1/dbs/orapwdb12c 12     false          0
sql>

orapwd 修改密码,密码是可以放在这里的:

[oracle@bakdb ~]$  orapwd file='/u01/app/oracle/product/12.2.0/db_1/dbs/orapwdb12c'  sysdg=y force=y
Enter password for SYS: 
Enter password for SYSDG: 
[oracle@bakdb ~]$ 
SQL*Plus: Release 12.2.0.1.0 Production on 星期六 7月 7 13:59:11 2018
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
输入口令:
连接到:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>

确认密码文件中存在该密码:

SQL> SELECT USERNAME FROM V$PWFILE_USERS ;
USERNAME
--------------------------------------------------------------------------------
SYS
SYSDG
SQL>
[oracle@bakdb ~]$  orapwd file='/u01/app/oracle/product/12.2.0/db_1/dbs/orapwdb12c'  sysdg=n force=y
Enter password for SYS: 
[oracle@bakdb ~]$
SQL> SELECT USERNAME FROM V$PWFILE_USERS ;
USERNAME
--------------------------------------------------------------------------------
SYS
SYSDG
SQL> /
USERNAME
--------------------------------------------------------------------------------
SYS
SQL>
C:\Users\lhongjie>sqlplus sysdg@db12c as sysdg
SQL*Plus: Release 12.2.0.1.0 Production on 星期六 7月 7 14:04:00 2018
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
输入口令:
ERROR:
ORA-01017: invalid username/password; logon denied
请输入用户名:
ERROR:
ORA-12560: TNS: 协议适配器错误
--原有密码无法登陆

–密码文件中存在该密码
–sqlplus 修改密码,如何呢–经过测试,密码可以修改成功!
–修改密码文件可以修改用户密码,修改用户密码同样也可以修改密码文件内部密码

参考文档:
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/admin/getting-started-with-database-administration.html#GUID-DA038801-BCE4-4E63-B260-759820983C5A

This entry was posted in oracle 12c. Bookmark the permalink.