Archive for the ‘12cDatabase’ Category

What is oratop   2 comments

OS: OEL 6.4

Oracle Software: 11gR2.

Oratop

oratop is a utility similar to the unix OS utility top which gives a overview of database performance and can be used in combination with top to get a more complete overview of system performance

Linux x86-64

NOTE: oratop can be used to monitor databases on other platforms but the executable must run on Linux with an Oracle client.

To monitor databases on other platforms simply define an alias in tnsnames.ora of the linux client and connect to the databases remotely as you would with sqlplus

Download the oratop executable for 11gR2 on Linux x86-64 here.

Download the oratop executable for 12c on Linux x86-64 for use with 12c clients here.

Download the oratop executable for 11gR2 on Linux x86-32 here.

Download the oratop executable for 12c on Linux x86-32 for use with 12c clients here.

Please download and review the oratop Users Guide for specific instructions on how to configure and run oratop.  A Quick Start Guide is provided in the Instructions section of this Note.

Running oratop

  1. Log in to the system as the Oracle RDBMS software installation owner
  2. Stage the oratop executable on the server on which the tool will be executed.  On a RAC system it is only necessary to stage the executable on one node as it is RAC aware.
  3. Change the name of the executable, eg.
  4. $ mv oratop* oratop
     Validate the permissions for oratop are 755 (-rwxr-xr-x). If the permissions are not currently set to 755, set the permissions on oratop as follows: 
  5. $ chmod 755 oratop
  6. Configure the execution environment as follows (if not already set accordingly)
  7. $ export TERM=xterm  #or vt100

    $ export ORACLE_HOME=<11.2 database home>
    $ export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    $ export PATH=$ORACLE_HOME/bin:$PATH
    $ export ORACLE_SID=<local 11.2 database SID to be monitored>  #only needed if connecting to a local database
  8. Invoke the tool to monitor a local database as follows (interval can be any interval in seconds):
    $ ./oratop -i 10 / as sysdba
  9. Non-dba privileged user requires specific grants to use the tool.  See User Guide for grants required.
  10. Databases can be monitored remotely using a tns alias as described in the oratop Users Guide.
  11. $ ./oratop -i 10 username/password@tns_alias
    $ ./oratop -i 10 system/manager@tns_alias
  12. To exit the program simply press the keyboard key “q”.  To abort, CTRL-C.

33

22

 

In my case nothing is running so i got below screen

2

 

 

 

 

Advertisements

Posted December 17, 2013 by balaoracledba.com in 12cDatabase, Oracle DBA, Oracle10g/11g, OracleRAC

12c Unplugging and Plugging the Database in the Same Container Database-PART7   Leave a comment

Here we are going to unplug TESTPDB1 and plug again with different name as “pdb_plug_nocopy”

So here we have 1 Container Database
1 Seeded Pluggable Database
1 Pluggable databases

2

Close the database.

alter pluggable database TESTPDB1 close immediate;

29-10-2013 12-44-50

Unlug the closed TESTPDB1 and then specify the path and name of the XML file.

mkdir -p /u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/

alter pluggable database TESTPDB1 unplug into ‘/u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/TESTPDB_PLUG1.xml’;

29-10-2013 12-47-22

Drop the closed PDB and keep the data files.

drop pluggable database TESTPDB1 keep datafiles;

select pdb_name, status from cdb_pdbs where pdb_name=’TESTPDB1′;

29-10-2013 12-48-08

The unplugging operation makes changes in the TESTPDB1 data files to record that the PDB was properly and successfully unplugged.

move the datafiles of testpd1 from /u01/app/oracle/oradata/CDB/testpdb1 to /u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/

also edit the /u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/TESTPDB_PLUG1.xml as per the changed locations accordingly.

Checking the Compatibility of the Unplugged PDB with the Host CDB
Before starting the plugging operation, make sure that the to-be-plugged-in PDB is compatible with the new host CDB. Execution of the PL/SQL block raises an error if it is not compatible.

Execute the following PL/SQL block:

set serveroutput on
DECLARE
compatible BOOLEAN := FALSE;
BEGIN
compatible := DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
pdb_descr_file => ‘/u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/TESTPDB_PLUG1.xml’);
if compatible then
DBMS_OUTPUT.PUT_LINE(‘Is pluggable TESTPDB1 compatible? YES’);
else DBMS_OUTPUT.PUT_LINE(‘Is pluggable TESTPDB1 compatible? NO’);
end if;
END;
/

29-10-2013 12-57-29

Plugging the Unplugged TESTPDB1: NOCOPY Method
Use the data files of the unplugged PDB to plug the PDB into another CDB without any copy.

create pluggable database pdb_plug_nocopy using ‘/u01/app/oracle/oradata/CDB/TESTPDB_PLUG1/TESTPDB_PLUG1.xml’
NOCOPY
TEMPFILE REUSE;29-10-2013 12-58-13

This operation lasts a few seconds. The original data files of the unplugged PDB now belong to the new plugged-in PDB in the new host CDB. A file with the same name as the temp file specified in the XML file exists in the target location. Therefore, the TEMPFILE_REUSE clause is required.

Verify the status and open mode of the plugged PDB. Proceed to the next section, “Opening the Plugged PDB,” to finalize the plugging operation.
select pdb_name, status from cdb_pdbs where pdb_name=’pdb_plug_nocopy’;

select open_mode from v$pdbs where name=’pdb_plug_nocopy’;

List the data files of the plugged PDB.
select name from v$datafile where con_id=3;

29-10-2013 13-13-04

Open the Database

last

lllll

 

NOTE: TESTPDB2 is another Pluggable Database which was there already.

Posted October 29, 2013 by balaoracledba.com in 12cDatabase

12c Creating Pluggable Database using DBCA-PART6   Leave a comment

Creating Pluggable Database using DBCA

In my previous post I have created pluggable database using script. Today i going to provide steps to create Pluggable Database Using DBCA

Step1:

I am starting my database here.

1

When I query for the possible databases that are there, i got below output. I have already created one pluggable database TESTPDB1 earlier.

2

I tried to find out the datafiles that are there in my database. Here i can see only datafiles which got created with my container database and also i can see pluggable seeded datafiles., but i am not able to see the TESTPD1 pluggables database datafiles

3

To view the Pluggable Database datafiles, we need to open pluggable database TESTDB1

7

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now here we are going to create another PLUGGABLE DATABASE TESTPDB2 using DBCA

5

To find the status of the created database:

6

TO view the Database files for all the databases

8

Posted October 16, 2013 by balaoracledba.com in 12cDatabase, Oracle DBA

12c-Creating Pluggable Database Inside in Container Database-PART5   Leave a comment

AS you all know I have created a root container in my previous post named CDB$ROOT.

https://oracleappsdbar12.wordpress.com/2013/10/09/creating-a-container-database-in-12c/

The root contains the master set of data dictionary views, which have metadata regarding the root as well as every child pluggable database within the CDB.

With Container we have a Seeded Pluggable database it exists solely as a template for providing data files and metadata used to create new pluggable databases within the CDB. Each pluggable database is self-contained and functions like an isolated non-CDB database. Additionally, each pluggable database contains its own data files and application objects (users, tables, indexes
and so on). When connected to a pluggable database, there is no visibility to the root container or any other pluggable databases present within the CDB.

pdb1

 

 

 

 

 

 

Cloning the Seed Database
The CREATE PLUGGABLE DATASE statement can be used to create a pluggable database by copying the seed database’s data files. To do this, first connect to the root container database as the SYS user:

[ora12c@xxxxxx admin]$ sqlplus '/as sysdba'
SQL*Plus: Release 12.1.0.1.0 Production on Thu Oct 10 07:43:41 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> select con_id, name from v$containers;
CON_ID NAME
---------- ------------------------------
 1 CDB$ROOT
 2 PDB$SEED
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[ora12c@xxxxx admin]$ cd /u01/dbfile/CDB/pdbseed
[ora12c@xxxxx pdbseed]$ ls
sysaux01.dbf system01.dbf temp01.dbf users01.dbf
[ora12c@xxxxx pdbseed]$ cd
[ora12c@xxxxxx ~]$ vi testpdb1.sql
[ora12c@xxxxxx ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 12.1.0.1.0 Production on Thu Oct 10 07:50:57 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> @testpdb1.sql
FILE_NAME_CONVERT = ('/u01/dbfile/CDB/pdbseed','/u01/app/oracle/oradata/CDB/testpdb1,''/u01/dbfile/CDB','/u01/app/oracle/oradata/CDB/testpdb1')
 *
ERROR at line 3:
ORA-02000: missing , keyword
vi testpdb1.sql
CREATE PLUGGABLE DATABASE testpdb1
ADMIN USER testdba IDENTIFIED BY oracle
FILE_NAME_CONVERT = ('/u01/dbfile/CDB/pdbseed','/u01/app/oracle/oradata/CDB/testpdb1','/u01/dbfile/CDB','/u01/app/oracle/oradata/CDB/testpdb1');
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Note : The FILE_NAME_CONVERT clause in this example has two strings. One specifies the location of the seed database data files:
/u01/app/oracle/oradata/CDB/pdbseed

The second string is the location where you want the new pluggable database’s data files created:

/u01/app/oracle/oradata/CDB/testpdb1

[ora12c@xxxxx ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 12.1.0.1.0 Production on Thu Oct 10 07:51:55 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> @testpdb1.sql
Pluggable database created.
pdb2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After setting to container to CDB$ROOT now check again

pdb3

 

 

 

 

 

 

Hope this post Helps

Posted October 10, 2013 by balaoracledba.com in 12cDatabase, Oracle DBA

Creating a Container Database in 12c-PART4   Leave a comment

Creating a CDB:

To use the pluggable database feature, we have to specifically create a pluggable enabled CDB.
There are a several different techniques for creating a CDB:

• Manually issuing the SQL CREATE DATABASE command

• Using DBCA

• Generating the required scripts with the DBCA, and then manually running the scripts to create a CDB.

• Using RMAN to duplicate an existing CDB

Creating Manually with SQL:

Note: As of now I am listing the steps to Create Container Database Manually.  I will also try to post the other methods of creating CDB.

First, ensure that your ORACLE_SID, ORACLE_HOME, and PATH variables are set for your CDB environment.

Next, create a parameter initialization file in the ORACLE_HOME/dbs directory. Make certain you set the ENABLE_PLUGGABLE_DATABASE parameter to TRUE. Here, I’ve used an OS text editor to create a file named initCDB.ora and placed within it the following parameter specifications:

db_name='CDB'
 enable_pluggable_database=true
 audit_trail='db'
 control_files='/u01/dbfile/CDB/control01.ctl','/u01/dbfile/CDB/control02.ctl'
 db_block_size=8192
 db_domain=''
 memory_target=629145600
 memory_max_target=629145600
 open_cursors=300
 processes=300
 remote_login_passwordfile='EXCLUSIVE'
 undo_tablespace='UNDOTBS1'

initCDB.ora

ctl

 

 

 

 

 

 

 

 

mkdir -p /u01/dbfile/CDB/pdbseed

 mkdir -p /u01/dbfile/CDB
 mkdir -p /u01/oraredo/CDB

Now, start up your database in nomount mode, and run the credb.sql script:

$ sqlplus / as sysdba
 SQL> startup nomount;
 SQL> @credb.sql

cdb1

 

 

 

 

 

 

 

 

 

Contents of credb.sql

CREATE DATABASE CDB
 MAXLOGFILES 16
 MAXLOGMEMBERS 4
 MAXDATAFILES 1024
 MAXINSTANCES 1
 MAXLOGHISTORY 680
 CHARACTER SET US7ASCII
 NATIONAL CHARACTER SET AL16UTF16
 DATAFILE
 '/u01/dbfile/CDB/system01.dbf' SIZE 500M
 EXTENT MANAGEMENT LOCAL
 UNDO TABLESPACE undotbs1 DATAFILE
 '/u01/dbfile/CDB/undotbs01.dbf' SIZE 800M
 SYSAUX DATAFILE
 '/u01/dbfile/CDB/sysaux01.dbf' SIZE 500M
 DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE
 '/u01/dbfile/CDB/temp01.dbf' SIZE 500M
 DEFAULT TABLESPACE USERS DATAFILE
 '/u01/dbfile/CDB/users01.dbf' SIZE 50M
 LOGFILE GROUP 1
 ('/u01/oraredo/CDB/redo01a.rdo') SIZE 50M,
 GROUP 2
 ('/u01/oraredo/CDB/redo02a.rdo') SIZE 50M
 USER sys IDENTIFIED BY oracle
 USER system IDENTIFIED BY oracle
 USER_DATA TABLESPACE userstbs DATAFILE
 '/u01/dbfile/CDB/userstbsp01.dbf' SIZE 500M
 ENABLE PLUGGABLE DATABASE
 SEED FILE_NAME_CONVERT = ('/u01/dbfile/CDB','/u01/dbfile/CDB/pdbseed');

USER_DATA TABLESPACE clause specifies that an additional tablespace be created within the seed database; this tablespace will also be replicated to any pluggable databases that are cloned from the seed database.

Also, the SEED FILE_NAME_CONVERT specifies how the seed database files will be named and in what directories they will be located. Next, ensure you have created any directories referenced in the parameter file and the CREATE DATABASE statement:

cdb2


crdb3

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If successful, you should see this:

Database created.

Oracle recommends that you use the catcon.pl Perl script to run any Oracle supplied SQL scripts for a CDB. Therefore to create the data dictionary for a CDB use the catcon.pl Perl script. First change directories to the ORACLE_HOME/rdbms/admin directory:

$ cd $ORACLE_HOME/rdbms/admin

Now use catcon.pl to run the catalog.sql script as SYS:

$ perl catcon.pl -u sys/oracle -s -e -d $ORACLE_HOME/rdbms/admin -b catalog1 catalog.sql > catcon-catalog.log

Next, use catcon.pl to run the catproc.sql script as SYS:

$ perl catcon.pl -u sys/oracle -s -e -d $ORACLE_HOME/rdbms/admin -b catproc1 catproc.sql > catcon-catproc.log

After you have created the data dictionary, as the SYSTEM schema, create the product user profile tables:

$ perl catcon.pl -u system/oracle -s -e -d $ORACLE_HOME/sqlplus/admin -b pupbld1 pupbld.sql > catcon-pupbld.log

cdb4

At this point, we have a fully functional CDB database and can start creating pluggable databases within it.

$ sqlplus / as sysdba
You can now confirm that the CDB was successfully created via this query. If a database was created as a CDB,the CDB column of V$DATABASE will contain a YES value:

SQL> select name, cdb from v$database;

Here is some sample output:

NAME CDB
——— —
CDB YES

At this point, you should have two containers in your CDB database: the root container and the seed pluggable database. You can check with this query:

SQL> select con_id, name from v$containers;

Here is some sample output:

CON_ID NAME
—— ——————–
1 CDB$ROOT
2 PDB$SEED

cdb5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Note that if you had selected from DBA_DATA_FILES instead of CDB_DATA_FILES, you would only see the four data files associated with the root container (the container you’re currently connected to); for example,

cdb6

 

 

 

 

 

 

This Ends the Creation of Container Database.

My Next post will be on creating Pluggable Database

Posted October 9, 2013 by balaoracledba.com in 12cDatabase, Oracle DBA

12c Installation-PART3   Leave a comment

In this Post I will list out the steps for 12c Database Installation

Download Software

Download the Oracle software from OTN or MOS depending on your support status.

Unpack Files

Unzip the files.

V38500-01_1of2.zip

V38500-01_2of2.zip

Hosts File

The “/etc/hosts” file must contain a fully qualified name for the server.

<IP-address>  <fully-qualified-machine-name>  <machine-name>

For example.

127.0.0.1       localhost.localdomain  localhost
192.168.1.10    db12c.localdomain      db12c

Oracle Installation Prerequisites

Perform either the Automatic Setup or the Manual Setup to complete the basic prerequisites. The Additional Setup is required for all installations.

Automatic Setup

If you plan to use the “oracle-rdbms-server-12cR1-preinstall” package to perform all your prerequisite setup, issue the following command.

# yum install oracle-rdbms-server-12cR1-preinstall -y

Manual Setup

If you have not used the “oracle-rdbms-server-12cR1-preinstall” package to perform all prerequisites, you will need to manually perform the following setup tasks.

Add or amend the following lines in the “/etc/sysctl.conf” file.

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500

Run the following command to change the current kernel parameters.

/sbin/sysctl -p

Add the following lines to the “/etc/security/limits.conf” file.

oracle   soft   nofile    1024
oracle   hard   nofile    65536
oracle   soft   nproc    2047
oracle   hard   nproc    16384
oracle   soft   stack    10240
oracle   hard   stack    32768

Install the following packages if they are not already present.

# From Public Yum or ULN
yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install gcc -y
yum install gcc-c++ -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libXext -y
yum install libXext.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install make -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

Create the new groups and users.

groupadd dba

useradd -g dba ora12c

Additional Setup

The following steps must be performed, whether you did the manual or automatic setup.

Set the password for the “oracle” user.

passwd oracle

Amend the “/etc/security/limits.d/90-nproc.conf” file as described below. See MOS Note [ID 1487773.1]

# Change this
*          soft    nproc    1024

# To this
* - nproc 16384

Set secure Linux to permissive by editing the “/etc/selinux/config” file, making sure the SELINUX flag is set as follows.

SELINUX=permissive

Once the change is complete, restart the server or run the following command.

# setenforce Permissive

If you have the Linux firewall enabled, you will need to disable or configure it, as shown here or here. To disable it, do the following.

# service iptables stop
# chkconfig iptables off

Create the directories in which the Oracle software will be installed.

mkdir -p /u01/app/oracle/product/12.1.0/db_1
chown -R oracle:dba /u01
chmod -R 775 /u01

Unless you are working from the console, or using SSH tunnelling, login as root and issue the following command.

xhost +<machine-name>

Add the following lines at the end of the “/home/oracle/.bash_profile” file.

# Oracle Settings
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=ol6-121.localdomain
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export ORACLE_SID=cdb1

export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

Installation

Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable.

DISPLAY=<machine-name>:0.0; export DISPLAY

Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory.

./runInstaller

Proceed with the installation of your choice.

1

2

3

Here i have selected option as Install Database Software Only. I will Create Database manually.

4

5

6

7

8

9

10

11

12

13

14

15

16

17

In My next Post i will list out the steps to create Container Database and Pluggable Database

Posted October 9, 2013 by balaoracledba.com in 12cDatabase

12c New Terminologies-PART2   Leave a comment

12c Database Pluggable Terms:

PDFF

Posted October 9, 2013 by balaoracledba.com in 12cDatabase