Category Archives: Oracle

Oracle DB 12C op Oracle Linux 7

Download de Oracle 12 C database en pak hem uit in OraDB12C


[root@cerita home]# mkdir OraDB12c
[root@cerita home]# cd OraDB12c/
[root@cerita OraDB12c]# mv ../oracle/Downloads/linuxamd64_12102_database_1of2.zip .
[root@cerita OraDB12c]# mv ../oracle/Downloads/linuxamd64_12102_database_2of2.zip .
[root@cerita OraDB12c]# ls
linuxamd64_12102_database_1of2.zip  linuxamd64_12102_database_2of2.zip
[root@cerita OraDB12c]# unzip linuxamd64_12102_database_1of2.zip
[root@cerita OraDB12c]# unzip linuxamd64_12102_database_2of2.zip 

Installeer als user oracle

[oracle@cerita home]$ cd OraDB12c/
[oracle@cerita OraDB12c]$ cd database
[oracle@cerita database]$ ./runInstaller 
Starting Oracle Universal Installer...

De installer komt op een gegeven moment met een scherm over missende prerequisites.
De kernel parameters zijn automatische the fixen, Oracle maakt hier een runfixup script voor.

[root@cerita database]# /tmp/CVU_12.1.0.2.0_oracle/runfixup.sh

maar een aantal libraries moeten nog worden geyummed.


$ yum -y install libaio-devel
$ yum -y install compat-libstdc++-33
$ yum -y install compat-libcap1

Tenslotte vraagt runInstaller nog twee scripts uit te voeren als root.


[root@cerita database]# /home/oracle/app/oraInventory/orainstRoot.sh
Changing permissions of /home/oracle/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /home/oracle/app/oraInventory to oinstall.
The execution of the script is complete.
[root@cerita database]# /home/oracle/app/oracle/product/12.1.0/dbhome_1/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/app/oracle/product/12.1.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/local/bin
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.

IMPDP

Prerequisites
Installed Oracle database
Created database

Create Linux user


su root
useradd brv11p2
usermod -g oinstall brv11p2
usermod -a -G dba brv11p2
passwd brv11p2
cd /home
chmod -R g+rwx oinstall

Prepare .bash_profile for Linux user


# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

export ORACLE_INSTALL=/home/oracle
export ORACLE_SID=brv11p2
PATH=$PATH:$ORACLE_INSTALL/bin:$ORACLE_INSTALL/app/oracle/product/11.2.0/dbhome_1/bin/

export PATH

export ORACLE_BASE=$ORACLE_INSTALL/app/oracle
export ORACLE_HOME=$ORACLE_INSTALL/app/oracle/product/11.2.0/dbhome_1

Create table space


SQL> CREATE BIGFILE TABLESPACE "tablespace" DATAFILE '/path/to/dbfile.dbf' SIZE 120G AUTOEXTEND ON NEXT 4G MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

Create user

SQL> create user whoever identified by password;
SQL> grant create session to whoever;
SQL> grant all privileges to sparcsn4;

Create database directories

Execute the following commands to create a database directory. This directory must point to a valid directory on the same server as the database:

SQL> CREATE DIRECTORY dmpdir AS 'path/to/directory/with/dumpfile/';

SQL> GRANT read, write ON DIRECTORY dmpdir TO whoever;

impdp parameter files
First import step excludes tables that just take space


vi step1.par
EXCLUDE=TABLE:"IN ('EDI_TRANSACTION','ROAD_DOCUMENTS','FRM_JOB_LOG','EDI_TRANSACTION_KEYWORD','EDI_BATCH_PROCESS','EDI_INTERCHANGE','EDI_EVENT','EDI_SEGMENT','EDI_BATCH','EDI_ERROR')"

Second import step creates the skipped tables


vi step2.par
DIRECTORY=dmpdir
CONTENT=METADATA_ONLY
TABLES=EDI_TRANSACTION,ROAD_DOCUMENTS,FRM_JOB_LOG,EDI_TRANSACTION_KEYWORD,EDI_BATCH_PROCESS,EDI_INTERCHANGE,EDI_EVENT,EDI_SEGMENT,EDI_BATCH,EDI_ERROR

Import database

Single dumpfile


impdp DIRECTORY=dmpdir dumpfile=thedumpfile parfile=/path/to/parfile.par

Numbered dumpfile %U


impdp DIRECTORY=dmpdir dumpfile=thedumpfile_%U parfile=/path/to/parfile.par

PS: Oracle introduced a default directory from 10g R2, called DATA_PUMP_DIR, that can be used:

SQL> SELECT directory_path FROM dba_directories WHERE directory_name = 'DATA_PUMP_DIR';

DIRECTORY_PATH
--------------------------------------------------------------------------------
/app/oracle/product/10.2.0/rdbms/log/

CTW on Oracle Linux

mv expdat.expdp.BRV11T2.sonder.N4TOST2.B3.0_C1.13 /home/oracle/app/oracle/admin/satu/dpdump/expdat.dmp
impdp

Zegt zelf wel waar hij problemen mee heeft. Mekkert over users, table spaces en niet genoeg ruimte in de table space.

sqlplus /nolog

connect / as SYSDBA

create user N4TOST2 identified by S3marang;

create tablespace N4TOST2 DATAFILE '/home/oracle/app/oracle/oradata/satu/n4tost2.dbf' size 1G extent management local autoallocate;

alter database datafile '/home/oracle/app/oracle/oradata/satu/n4tost2.dbf' resize 10G;

select dbms_metadata.get_ddl('TABLESPACE','N4TOST2' ) from dual;

=== TNSNAMES ===
[oracle@burung ~]$ tnsping satu

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 24-JUL-2013 14:53:14

Copyright (c) 1997, 2009, Oracle. All rights reserved.

Used parameter files:

TNS-03505: Failed to resolve name

[oracle@burung ~]$ vi ./app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

[oracle@burung ~]$ tnsping satu

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 24-JUL-2013 15:05:32

Copyright (c) 1997, 2009, Oracle. All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = burung.mcint.local) (PORT=1521))) (CONNECT_DATA = (SERVICE_NAME = satu)))
OK (20 msec)

Oracle 11g on Oracle Enterprise Linux

How I Simplified Oracle Database 12c and 11g Installations on Oracle Linux 6

by Ginny Henningsen; updated by Michele Casey

How to simplify the installation of Oracle Database 12c or 11g on Oracle Linux 6 by installing the oracle-rdbms-server-12cR1-preinstall or oracle-rdbms-server-11gR2-preinstall RPM package, which automatically performs a number of tasks, such as installing required software packages, resolving package dependencies, and modifying kernel parameters.

http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux-488779.html

 

As root perform pre-installation script that also creates user:group oracle:oinstall

# cd /etc/yum.repos.d
# wget http://public-yum.oracle.com/public-yum-ol6.repo
# vi public-yum-ol6.repo
# yum install oracle-rdbms-server-11gR2-preinstall
# cd /home
# mkdir OraDB11g
# chown oracle:oinstall OraDB11g
# cd OraDB11g
# unzip linux.x64_11gR2_database_1of2.zip
# unzip linux.x64_11gR2_database_2of2.zip
# yum -y install unixODBC-devel

As root activate user oracle by setting password

 
# passwd oracle

As root modify hosts file otherwise listener won’t work.

# vi /etc/hosts
host-ip  oraclehost.domain  oraclehost

Log in as the user oracle. Change directory to the database directory and enter the following command to run the Oracle Universal Installer:

# cd /home/OraDB11g/database
# ./runInstaller

no email
no security updates [Yes]
(*) database software only
(*) Single instance database installation
Language := English
(*) Enterprise Edition
Oracle base [/home/oracle/app/oracle]
Oracle home [/home/oracle/app/oracle/product/11.2.0/dbhome_1]
Oracle inventory [/home/oracle/app.oraInventory]
Oracle invetory groupname [oinstall]
OSDBA DBA Group [dba]
OSOPER Operator Group [oninstall]

Installer asks to run two installation scripts as root

[root@burung oracle]# /home/oracle/app/oraInventory/orainstRoot.sh
[root@burung oracle]# /home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh

Create user specific environment and startup programs

vi .bash_profile

PATH=$PATH:$HOME/bin:$HOME/app/oracle/product/11.2.0/dbhome_1/bin/
export PATH
export ORACLE_BASE=$HOME/app/oracle
export ORACLE_HOME=$HOME/app/oracle/product/11.2.0/dbhome_1

Start Oracle Listener

[oracle@burung ~]# lsnrctl start
[oracle@burung ~]# lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 22-JUL-2013 14:36:53

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 22-JUL-2013 14:36:33
Uptime 0 days 0 hr. 0 min. 20 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/burung/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=burung.mcint.local)(PORT=1521)))
The listener supports no services
The command completed successfully

As user oracle create a database. You need to login oracle owned GUI/VNC session!!
(start GUI duurt lang voordat de GUI tevoorschijn komt)
(Follow Oracle for dummies)

# dbca

Now you can start sqlplus

# export ORACLE_SID=sid
# sqlplus / as sysdba

startup
..
..
shutdown

# lsnrctl stop LISTENER

Enterprise manager is at: https://localhost:1158/em, but nobody cares anyway.

# emctl start
...
..
# emctl stop