Oracle 12c开启scott账户

在Oracle目录app\orcl\product\12.1.0\dbhome_1\NETWORK\ADMIN\下tnsnames.ora文件最后加入以下内容

PDBORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = PDBORCL)
    )
  )

然后进入sqlplus连接登陆sys账号,运行以下语句

SQL > conn sysYouPassword as sysdba;
SQL > alter session set container = PDBORCL;
SQL > startup
SQL > conn sys@pdborclYouPassword as sysdba;
SQL > alter user scott account unlock identified by tiger;
SQL > conn sysYouPassword as sysdba;
SQL > CREATE OR REPLACE TRIGGER open_all_pdbs
    AFTER STARTUP
    ON DATABASE
    BEGIN
    EXECUTE IMMEDIATE 'alter pluggable database all open';
    END open_all_pdbs;   
SQL > shutdown immediate
SQL > startup

至此已经可以使用账号scott@pdborcl密码tiger登陆了

相关推荐