Oracle XE恢复SCOTT账户

  1. scott.sql上传到根目录。

  2. SSH连接到CentOS,使用sys登录Oracle,密码是之前设置的密码。
    1
    2
    3
    4
    5
    sqlplus /nolog  
    connect as sysdba  
    Enter user-name: sys  
    Enter password:  
    Connected. 
    
  3. 执行scott.sql
    1
    @ /root/scott.sql  
    
  4. 重新解锁账户, 更改密码, 赋予dba权限。
    1
    2
    3
    alter user scott account unlock;
    alter user scott identified by tiger;
    grant dba to scott;
    
  5. 然后重新scott账户,密码tiger进行登录。
    1
    2
    sqlplus /nolog
    conn scott/tiger
    
  6. 确认是否生效。
    1
    select count(*) from emp;
    
  7. 得到以下结果即生效
    1
    2
    3
      COUNT(*)
    ----------
     14
    

参考文章

  1. http://www.orafaq.com/wiki/SCOTT