Difference between revisions of "12c database syntaxes"
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
| + | * Create a pluggable database. | ||
| + | <pre> | ||
| + | SQL> create pluggable database pdb12c admin user john identified by doe; | ||
| + | SQL> alter pluggable database pdb12c open; | ||
| + | </pre> | ||
| + | |||
| + | * Show con_name and con_id. | ||
| + | <pre> | ||
| + | SQL> show con_name | ||
| + | |||
| + | CON_NAME | ||
| + | ------------------------------ | ||
| + | CDB$ROOT | ||
| + | |||
| + | SQL> show con_id | ||
| − | * | + | CON_ID |
| + | ------------------------------ | ||
| + | 1 | ||
| + | </pre> | ||
| + | |||
| + | * Display all services | ||
<pre> | <pre> | ||
| − | + | SQL> select name, con_id from v$active_services order by 1; | |
| − | + | ||
| + | NAME CON_ID | ||
| + | ---------------------------------------------------------------- ---------- | ||
| + | SYS$BACKGROUND 1 | ||
| + | SYS$USERS 1 | ||
| + | cdb12c.localdomain 1 | ||
| + | cdb12cXDB 1 | ||
| + | pdb12c.localdomain 3 | ||
</pre> | </pre> | ||
| + | |||
* Create a user in the pluggable database. | * Create a user in the pluggable database. | ||
<pre> | <pre> | ||
| − | alter session set container=pdb12c; | + | -- Cannot create a user in the container database. |
| − | create user test identified by test; | + | SQL> create user test identified by test; |
| + | create user test identified by test | ||
| + | * | ||
| + | ERROR at line 1: | ||
| + | ORA-65096: invalid common user or role name | ||
| + | |||
| + | -- Switch to the pluggable database first. | ||
| + | SQL> alter session set container=pdb12c; | ||
| + | Session altered. | ||
| + | |||
| + | SQL> create user test identified by test; | ||
| + | User created. | ||
| + | |||
</pre> | </pre> | ||
[[Category: Oracle Database]] | [[Category: Oracle Database]] | ||
[[Category: Oracle 12c]] | [[Category: Oracle 12c]] | ||
Revision as of 09:06, 13 August 2013
- Create a pluggable database.
SQL> create pluggable database pdb12c admin user john identified by doe; SQL> alter pluggable database pdb12c open;
- Show con_name and con_id.
SQL> show con_name CON_NAME ------------------------------ CDB$ROOT SQL> show con_id CON_ID ------------------------------ 1
- Display all services
SQL> select name, con_id from v$active_services order by 1; NAME CON_ID ---------------------------------------------------------------- ---------- SYS$BACKGROUND 1 SYS$USERS 1 cdb12c.localdomain 1 cdb12cXDB 1 pdb12c.localdomain 3
- Create a user in the pluggable database.
-- Cannot create a user in the container database.
SQL> create user test identified by test;
create user test identified by test
*
ERROR at line 1:
ORA-65096: invalid common user or role name
-- Switch to the pluggable database first.
SQL> alter session set container=pdb12c;
Session altered.
SQL> create user test identified by test;
User created.