一、操作描述
最近在迁移数据的时候修改字符集时,需切换system用户,由于密码忘记,输入多次PLSQL提示“ORA-2800:the account is locked”,如下图所示,很明显oracle账号被锁住了
二、解决步骤
1.开始在运行窗口“cmd”,在窗口输入sqlplus / as sysdba,选择一个dba角色账号登录输入用户名,密码登录
2.通过“alter user "SYSTEM" ACCOUNT UNLOCK;”对system进行解锁
3.修改密码 - alter user system identified by system;
三、修改字符集
1.服务端字符集修改为ZHS16GBK
SQL> @b@将数据库启动到RESTRICTED模式下做字符集更改:@b@ @b@SQL> conn /as sysdba @b@Connected. @b@@b@SQL> shutdown immediate; @b@Database closed. @b@Database dismounted. @b@ORACLE instance shut down. @b@@b@SQL> startup mount @b@ORACLE instance started. @b@Total System Global Area 236000356 bytes @b@Fixed Size 451684 bytes @b@Variable Size 201326592 bytes @b@Database Buffers 33554432 bytes @b@Redo Buffers 667648 bytes @b@Database mounted. @b@@b@SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION; @b@System altered. @b@@b@SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; @b@System altered. @b@@b@SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0; @b@System altered. @b@@b@SQL> alter database open; @b@Database altered. @b@SQL> ALTER DATABASE CHARACTER SET ZHS16GBK; @b@ALTER DATABASE CHARACTER SET ZHS16GBK @b@* @b@ERROR at line 1: @b@ORA-12712: new character set must be a superset of old character set @b@@b@提示我们的字符集:新字符集必须为旧字符集的超集,这时我们可以跳过超集的检查做更改: @b@@b@SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK; @b@Database altered. @b@@b@SQL> select * from v$nls_parameters; @b@略 @b@19 rows selected. @b@重启检查是否更改完成: @b@@b@SQL> shutdown immediate; @b@Database closed. @b@Database dismounted. @b@ORACLE instance shut down. @b@@b@SQL> startup @b@ORACLE instance started. @b@Total System Global Area 236000356 bytes @b@Fixed Size 451684 bytes @b@Variable Size 201326592 bytes @b@Database Buffers 33554432 bytes @b@Redo Buffers 667648 bytes @b@Database mounted. @b@Database opened. @b@@b@SQL> select * from v$nls_parameters; @b@略 @b@19 rows selected. @b@+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2.客户端字符集修改
在 /home/oracle与 /root用户目录下的.bash_profile中 ,添加或修改 export NLS_LANG="AMERICAN_AMERICA.UTF8" 语句,关闭当前ssh窗口。
四、查看谁锁库
--查看xwooduser数据库用户被什么时候锁住了@b@select * from dba_users where username='xwooduser' order by lock_date desc @b@@b@--通过查看登录数据库记录,分析哪台机器锁的@b@select * from logon_denied order by login_time desc;