Sei sulla pagina 1di 33

How to Install Oracle Database 12c on CentOS 7

Install required Packages


Open Terminal and type

[shivam@localhost ~]$su
enter password then execute below cmd

To stop auto updates use in centos7


systemctl status packagekit
systemctl stop packagekit

WE NEED TO DISABLE FIREWALL D


systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld

[root@localhost shivam]# yum install vim

[shivam@localhost ~]vim /etc/selinux/con-fig write down Permissive if not there .

Press I Button and edit it

SELINUX=permissive
after that

press ESC button

:wq!
Setenforce 0
COPY AND PASTE IN TERMINAL

yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 \


glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-
devel.x86_64 \
libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686
libXi.x86_64 \
libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64

Configure User and System


Oracle Database will run under a normal Linux user and not with root privileges. In this step, we will create a new
user and group for Oracle.

Create new groups named 'oinstall' and 'dba', then create a new user 'oracle' and add it to the 'oinstall'
group.

Execute this commands on Terminal


[root@localhost shivam]groupadd oinstall
[root@localhost shivam]groupadd dba
[root@localhost shivam]useradd -g oinstall -G dba oracle
[root@localhost shivam]passwd oracle
[root@localhost shivam]TYPE THE PASSWORD
New user and group are created, now we need to configure our system for the Oracle installation. There
are some kernel parameters that we must configure for the Oracle installation.
Edit 'sysctl.conf' file with vim.

[root@localhost shivam]vim /etc/sysctl.conf


(these parameters differ from system to system to find those execute the following commands)

Parameter Command
semmsl, semmns, semopm, and # /sbin/sysctl -a | grep sem
semmni
This command displays the value of the semaphore parameters in
the order listed.

shmall, shmmax, and shmmni # /sbin/sysctl -a | grep shm

This command displays the details of the shared memory segment


sizes.

file-max # /sbin/sysctl -a | grep file-max

This command displays the maximum number of file handles.

ip_local_port_range # /sbin/sysctl -a | grep ip_local_port_range

This command displays a range of port numbers.


Parameter Command
rmem_default # /sbin/sysctl -a | grep rmem_default
rmem_max # /sbin/sysctl -a | grep rmem_max
wmem_default # /sbin/sysctl -a | grep wmem_default
wmem_max # /sbin/sysctl -a | grep wmem_max
aio-max-nr # /sbin/sysctl -a | grep aio-max-nr

fs.aio-max-nr = 1048576
fs.file-max = 3240229
kernel.shmall = 18446744073692774399
kernel.shmmax = 18446744073692774399
kernel.shmmni = 4096
kernel.sem = 250 32000 32 128
net.ipv4.ip_local_port_range = 32768 60999
net.core.rmem_default = 212992
net.core.rmem_max = 212992
net.core.wmem_default = 212992
net.core.wmem_max = 212992

Save the file and exit the editor.


Now run the commands below to display all kernel parameter and apply the new values.

sysctl -p
sysctl -a
Next, we need to configure some limits for the oracle user. Specify the max number process and max
number of open files descriptors.
Edit 'limits.conf' file with vim.
Go to terminal and execute this
{{{{==not required vim /etc/security/limits.conf
Paste the configuration below.
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Save the file and exit vim.==}}}

New user and system configuration is finished

Download Oracle Database

Login as oracle user and Enter password

If you do not have an Oracle account yet, register one and then log in to download 12c for Linux.
https://profile.oracle.com/myprofile/account/create-account.jspx
Oracle Database Software Downloads.
Downloads these files from 4shared
Install zip and unzip to extract the archives.
yum -y install zip unzip

[root@localhost ~]# unzip stage.zip' -d /


Extract the Oracle files to a new directory named 'stage'.
# unzip -Z stage.zip

T0 get stage file we need to unzip below two commands


# unzip linuxamd64_12102_database_se2_1of2.zip -d /stage/
# unzip linuxamd64_12102_database_se2_2of2.zip -d /stage/
place these files in Home directory

Change owner and group of the '/stage/' directory to the oracle user and oinstall group.

# chown -R oracle:oinstall /stage/


Next, create new directories for the Oracle installation files and Oracle database files.
Directory 'u01' is for the Oracle installation files and 'u02' for the Oracle database files.

mkdir -p /u01 /u02


Change owner and group of the new directories and set permissions to '755'.
chown -R oracle:oinstall /u01 /u02
chmod -R 775 /u01 /u02
chmod g+s /u01 /u02
Oracle is downloaded and the new directories for the installation are ready

Install Oracle Database 12c


Login as root shivam
[root@localhost shivam]# cd /stage/database/
# ./runInstaller (dot)
The script will check the server, make sure all tests are passed.

And you will see the GUI installation screen below, there click 'Next'.
At 'Installation Options', choose 'Create and configure a database' and click 'Next'.
Under the 'System Class' section, choose 'Desktop Class' and click 'Next' again.
Typical Installation' info.
• Oracle base: '/u01/app/oracle'
• Software location: /u01/app/oracle/product/12.1.0/dbhome_1
• Database file location: /u02
• Database edition: Default
• Character set: Default
• OSDBA group: dba
• Global database name: Type your own name
• Administrative password: Type your own password
• Confirm password: Type again
• Uncheck the 'Create as Container database'
Click Next.

U Have to change the CHARACTER SET TO “UNICODE”


At 'Create Inventory', enter the path below:
Inventory Directory: /u01/app/oraInventory
oraInventory Group Name: use 'oinstall' group.
Click 'Next'.
Make sure all checks completed without an error, then you will see a summary of the Oracle configuration.
Click 'Install'.
Installation process.
IF YOU GETTING ANY ERROR
During installation process, you will be asked to execute some scripts as root.
Open a new terminal and execute the files.
su
enter password
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/12.1.0/dbhome_1/root.sh

You will get the results below.


Next, you will be shown a new pop-up from the database configuration assistant, please wait, it takes a
time.
When the 'Database Configuration Assistant' is finished, you will see the info below:

Click 'Ok' and the Oracle database installation is done.


Click 'Close'.
Step 4 – Testing

The Oracle installation is finished and ready for testing. I will try to access Oracle from the command line first.

Log in to the server and access the oracle user.


Login as Root

~$ su enter password

Login to the oracle user.

su - oracle
Execute the commands below to set the oracle environment.
To login in to oracle database we need to execute this commands every time

[oracle@localhost ~]$ export ORACLE_SID=testing


[oracle@localhost ~]$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1/
[oracle@localhost ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@localhost ~]$ sqlplus / as sysdba

check the Oracle database character set


SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
select value from nls_database_parameters where
parameter='NLS_CHARACTERSET';VALUE---------------------------------------------

AL32UTF81
SQL>exit;

LINK : https://www.quora.com/How-do-you-check-the-Oracle-database-character-set
TO CREATE A ORACLE 12C DATABASE IN DATABASE

[oracle@localhost ~]$ export ORACLE_SID=testblank ( in exesting databses


creation)
[oracle@localhost ~]$ export
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1/
[oracle@localhost ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@localhost ~]$ dbca

next

select advanced options


size should be 30 %

then select character sets

and select unicode (all databases should be same or errors will popup during
running process)
summary

finished.

Unicode should be same to check execute theese

[oracle@localhost ~]$ export ORACLE_SID=testmasters


[oracle@localhost ~]$ export
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1/
[oracle@localhost ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@localhost ~]$ sqlplus / as sysdba

sql> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';


then each new database execute these commands

To check database is connecting or not

SQL> conn

SQL> system@databasename
passwd:

connected.

> ALTER SYSTEM SET open_cursors=3000 SCOPE=spfile; (enter commands manually)

> alter system set processes=3500 scope=spfile;

> alter system set sessions=2600 scope=spfile;

>shutdown immediate;

>startup

>show parameters; (to see changes)

--------------------------------------------------------
>ALTER SYSTEM SET open_cursors=3000 SCOPE=spfile;
alter system set processes=3500 scope=spfile;
alter system set sessions=2600 scope=spfile;

>shutdown immediate;

\\\

\\\\

>startup

-------------------------------------------------------------

Access the oracle database utility 'sqlplus', log in as 'sysdba' privileges.


sqlplus / as sysdba
Sqlplus is working fine.

su - oracle

oracle@ask :~$ sqlplus / as sysdba

SQL> startup
SQL> exit

cd $ORACLE_HOME
cd bin/
lsnrctl

LSNRCTL> start

LSNRCTL> exit
--------------------------------------------

Create users
drop user admin cascade;

drop user ots1 cascade;

drop user diagnotech cascade;

drop user inventory cascade;

drop user ip cascade;

drop user ats1 cascade;

drop user payroll cascade;

drop user bbank cascade;

drop user em cascade;

commit;

su - oracle

oracle@ask :~$ sqlplus / as sysdba

SQL> startup

exit once and check it


oracle@ask :~$ sqlplus
enter

{ IF YOU GETTING ANY ERRORS WHILE CREATING USERS EXECUTE THIS CMDS in 12c}

{SQL> connect system/manager as sysdba


Connected.
SQL> alter session set "_ORACLE_SCRIPT"=true;}
THEN TRY
create user admin identified by shivam;

grant all privileges to admin;

grant dba to admin;

commit;

create user ots1 identified by shivam;

grant all privileges to ots1;

grant dba to ots1;

commit;

create user diagnotech identified by shivam;

grant all privileges to diagnotech;

grant dba to diagnotech;

commit;

create user inventory identified by shivam;

grant all privileges to inventory;

grant dba to inventory;

commit;

create user ip identified by shivam;

grant all privileges to ip;

grant dba to ip;

commit;

create user ats1 identified by shivam;

grant all privileges to ats1;

grant dba to ats1;

commit;

create user payroll identified by shivam;

grant all privileges to payroll;

grant dba to payroll;

commit;

create user bbank identified by shivam;

grant all privileges to bbank;

grant dba to bbank;

commit;
create user em identified by shivam;

grant all privileges to em;

grant dba to em;

commit;

create user stockup identified by shivam;

grant all privileges to stockup;

grant dba to stockup;

commit;

su – oracle
run cmds in terminal

export ORACLE_SID=neosoft

export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1/
export PATH=$PATH:$ORACLE_HOME/bin

TO DELETE ORACLE DATABASE 12C

# dbca

Select delete database option


finish.

TO EXPORT ORACLE DATABASE 12C

[oracle@localhost ~]$ export ORACLE_SID=testmasters


[oracle@localhost ~]$ export
ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1/
[oracle@localhost ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@localhost ~]$ exp

username : system@databasename
passwd:shivam
dmp file: fbkp.dmp
selecte 1 for full database backup

Values of vim /etc/sysctl.conf


192.168.0.239 (testing server)
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 18446744073692774399
kernel.shmmax = 18446744073692774399
kernel.shmmni = 65536
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 32768 60999
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

192.168.0.175 (Testing server)


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

192.168.0.173 (Developing server)


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

192.168.0.213 ( Testing server)


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

Potrebbero piacerti anche