Wednesday, October 23, 2013

My Oracle 12c Cheat Sheet (for Windows)

I. installation

To install Oracle 12c on Windows, follow the excellent, step by step instructions given at this blog post by Tomaz Lesinski:
http://dbaora.com/install-oracle-12c-12-1-0-1-on-windows/
If you follow Tomasz Lesinski's sage advice, then all should go well. You might need to manually intervene during the installation process to "allow access" through your Windows Firewall (or you could turn the firewall off during the install). And if you encounter any "file not found" errors during the install, this probably means that the zip files got corrupted during the download, so just delete them and repeat the download.

II. using the sample schemas

To locate the sample schemas (hr, sh, oe, etc) which are now hidden away in "pluggable" databases, follow the simple explanations and directions given at the "slowdatum" blog here:
http://slowdatum.wordpress.com/2013/07/25/oracle-12c-finding-example-schema-hrshoe-etc/

Here are the essential six steps:
1. From the command line, enter SQLPLUS the usual way with:
sqlplus / as sysdba

2. In SQLPLUS connect to the "pluggable" database like this:
SQL> connect sys/pass@localhost:1521/pdborcl as sysdba

3. Now you must start up the pluggable database (by executing the command "startup").

4. Unlock the sample schemas (you only have to do this the first time you use them), for example:
SQL> alter user hr identified by hr account unlock;

5. Now you can connect to the hr account:
SQL> connect hr/hr@localhost:1521/pdborcl

6. Before you can connect to "hr" (etc) in SQLDeveloper, you must first unlock the accounts in SQLPLUS (as described in #4 above). Then to create the connection the slightly tricky part is that for accounts in pluggable databases you don't use the SID, rather you use the "Service Name", which by default should be "pdborcl".

III. to plug or not to plug?

What if you don't want to mess with pluggable databases? Here are a couple of things that you might find helpful:
1. In "container" databases (that is, non-pluggable ones) usernames must start with "C##". This does not apply to users in pluggable databases. Basically, the New Order as of 12c is that "container" databases (as opposed to "pluggable" databases) have "common" users, as opposed to "local" users which one has in the "pluggable" databases. Anyway, "common" usernames must start with "C##".
2. Previously (in 11g, for example) when you created a new user, and you wanted that user to have sufficient privileges to do stuff, you could do something like this (for a user called, for example, c##student):

GRANT CONNECT, RESOURCE TO c##student;
GRANT SELECT_CATALOG_ROLE TO c##student;
GRANT CREATE VIEW TO c##student;
BUT now (at least this is what I have found) you must also do the following:
GRANT UNLIMITED TABLESPACE TO c##student.

For more on container databases, common users, etc, check out some of these links:

No comments:

Post a Comment