Thursday, May 14, 2015

Dipping my toe into 12C (again). Creating a PDB and adding a Tablespace from the EM Express Page

I had a bit of a play with 12C when it first came out (V1 was way back in July 2013 - 12C V1 Released), then again when the update was released(Oct 2014).

I didn't delve too deeply into it, because of our 20+ clients (ranging from 1 database installed to Utilities companies with several hundred), not one is running 12C in Production, and few have any plans to upgrade / migrate to 12C.

I think it's because V11 (and actually V10) is so stable that they don't want to pay for all the testing that would be required, or the work involved in application changes, or the risk. Couple this with the fact that even for small companies, the uplift in license costs to maintain Sustained support for the old versions is not enough for them to move.

But I digress.

I usually install all the new releases onto an OEL VM, but due to time contraints I decided to put it on a Windows 7 laptop I had to hand. I also didn't dip into the advanced install, so just did a 'next,next,next' install. I also opted for the Container database because I want to have a look at this feature later.

The install was painless and fast, and the orcl database was installed seamlessly.

I don't like Oracle on Windows as a rule, but this is a test so I thought I'd go with it, plus some of our clients do have older versions running on Windows and I need to keep up my knowledge.

First thing I do is open a command prompt and see if I can connect to sqlplus easily. In this case, yes. Just the same as *nix - sqlplus / as sysdba .

Next, fire up the OEM Express using the URL that popped up after the install - https://localhost:5500/em

Sign in as sysdba, and wow, worked first time. Liking it so far.

Let's have a look at some of the other pages.

Under 'Performance', click on 'Performance Hub'. Ohhhh, pretty pictures.

I won't go into detail here, you can click on anything and everything. Suffice to say there is a lot of good stuff here. I noticed that it doesn't pop up any boxes telling you that you need the Diagnostics or Performance pack, so not sure what the deal is. It might be buried in the T&Cs somewhere, so you'd best check before using it, especially the SQL tuning bit.

One thing I did want to do was to see how easy it is to use this to do admin tasks like adding space. Well, it turned out that it's best to read the manual or do some googling.

From the main page, there is a 'Storage' menu item. Great, I'll add a new tablespace. Nope, the option isn't there. Turns out that this EM is for the CDB (Container Database), and that you can't add tablespaces to this, only to the PDBs (Pluggable Database). Since I chose this on install, I could play around.

At the top left of the page, it shows that there is a 'PDB' created on install. Reading the manual (http://docs.oracle.com/database/121/ADMQS/pdbs.htm#ADMQS12498)

describes the concepts. It is quite a change from the old way, so you should read it. Or like me, only read it when you can't get something to work.

At the top left of the page where it shows the general informaion is a clickable link, 'CDB':




Click on this to go the CDB / PDB page.

Creating a new PDB is pretty quick and straight forward. Just click on the 'Create' link.



And fill in the blanks.





That's it. Going to the location on the PC shows the files have been created:



Clicking on the PDB name takes you to the new screen:



Great, now to create some new tablespaces. Er, no. You are still connected to the CDB Enterprise Manager console, so clicking on the 'Storage' item still shows the same options, and no 'Tablespaces' one.

It turns out that each PDB has it's own console, defined with a port. This is to allow non-DBAs to administer their own PDBs (thanks Oracle, now there's less for me to do).

However, they are not enabled by default, they need to be turned on (yay, I'm not useless).

Go to SQLPlus to see the ports that are in use for the PDB OEMs;





select c.name,c.open_mode,e.port 
from v$pdbs c, xdb.xdb$cdbports e 
where c.con_id = e.pdb (+);
 
So, we need to set the port, but first need to connect to the PDB. I think I need to read the manual around the CDB / PDB concepts, things are getting complicated...

alter session set container = ANDYPDB;


And allocate a port:

exec dbms_xdb_config.sethttpsport(5505);


 
Go back to the browser and enter the URL with the new port, using the same SYS password as when you installed:





The 'Storage' drop-down now shows 'Tablespace' - actually that's all it shows.



Click on it, and it shows info about the current tablespaces.


Click on 'Create' to add a new one, or 'Add Datafile' to er, add a datafile.

I'll leave it to you to play.

So, using the GUI is not as intuitive as you'd think, there is still work to be done behind the scenes using good old SQLPlus.

As I discovered, if someone asks you to install a 12C database and you haven't used it before, it's quite a bit different from previous versions. Read the manual, especially around the CDB and PDB administration. 

UPDATE: So, the laptop I was using rebooted to apply some updates, then when I tried to connect to EM Express I got a blank page with Chrome (and Firefox) telling me the web page was not available. After a bit of googling, I found that for some reason the http ports had been reset:


SQL> select dbms_xdb_config.gethttpsport() from dual;

DBMS_XDB_CONFIG.GETHTTPSPORT()
------------------------------
                             0

So I just reset it and it worked again.

SQL> exec dbms_xdb_config.sethttpsport('5500');

PL/SQL procedure successfully completed.

SQL> select dbms_xdb_config.gethttpsport() from dual;

DBMS_XDB_CONFIG.GETHTTPSPORT()
------------------------------
                          5500

However, the CDB port keeps resetting to 0 if I set the container one and logout. I don't know why.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64
bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions

C:\Users\Andy>sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon May 18 15:07:14 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions

SQL> select dbms_xdb_config.gethttpsport() from dual;

DBMS_XDB_CONFIG.GETHTTPSPORT()
------------------------------
                             0

SQL> alter session set container=apexv5;

Session altered.

SQL> select dbms_xdb_config.gethttpsport() from dual;

DBMS_XDB_CONFIG.GETHTTPSPORT()
------------------------------
                          5505


No comments:

Post a Comment