Skip to content

Instantly share code, notes, and snippets.

@DarkAngelStrike
Created May 8, 2017 02:50
Show Gist options
  • Save DarkAngelStrike/845a78e29efd905dccbb6eb0a4df52ee to your computer and use it in GitHub Desktop.
Save DarkAngelStrike/845a78e29efd905dccbb6eb0a4df52ee to your computer and use it in GitHub Desktop.
[oracle@server ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed May 3 12:44:46 2017
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production
SYS@CDB> alter session set container=PDB;
Session altered.
SYS@CDB> create table backup_user$ as select * from user$;
Table created.
SYS@CDB> select spare1 from user$ where name='APEX_PUBLIC_USER';
SPARE1
----------
384
SYS@CDB> select username, common from cdb_users where username='APEX_PUBLIC_USER';
USERNAME COMMON
---------------------------------------------------------------------------- ------
APEX_PUBLIC_USER YES
SYS@CDB> update user$ set spare1=0 where name='APEX_PUBLIC_USER';
1 row updated.
SYS@CDB> select username, common from cdb_users where username='APEX_PUBLIC_USER';
USERNAME COMMON
---------------------------------------------------------------------------- ------
APEX_PUBLIC_USER NO
SYS@CDB> commit;
Commit complete.
SYS@CDB> shutdown immediate;
Pluggable Database closed.
SYS@CDB> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
4 PDB MOUNTED
SYS@CDB> startup
Pluggable Database opened.
SYS@CDB> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
4 PDB READ WRITE NO
SYS@CDB> select username, common from cdb_users where username = 'APEX_PUBLIC_USER';
USERNAME COMMON
---------------------------------------------------------------------------- ------
APEX_PUBLIC_USER NO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment