Tampilkan postingan dengan label Oracle. Tampilkan semua postingan
Tampilkan postingan dengan label Oracle. Tampilkan semua postingan

Export entire oracle database

For a full database export/import use
exp user@DB FULL=Y FILE=PATH_TO_DUMPFILE
imp
user@DB FULL=Y FILE=PATH_TO_DUMPFILE
The user must have EXP_FULL_DATABASE resp IMP_FULL_DATABASE role (or something equivalent, like DBA). DB is your database (e.g. XE, if you have expreess edition)

Data Import IMPDP Failed

So basically i was trying to import a dump file for schema rcemca into schema rcecms. (on a side note: you create schema by creating user. So each user has its own schema). I created the IMPDP_DIR by the following:

create directory IMPDP_DIR as '/home/firman/Downloads'
grant read, write on IMPDP_DIR to rcecms
commit


I then queried the database to makes sure the newly created directory is there
select * from all_directories


It was there.

OWNER       DIRECTORY_NAME
------------------------------ ------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
SYS       EXPDP_DIR
/home/firman/Downloads

SYS       XMLDIR
/u01/app/oracle/product/11.2.0/xe/rdbms/xml

SYS       DATA_PUMP_DIR

/u01/app/oracle/admin/XE/dpdump/

And then I did:
impdp system/password DIRECTORY=IMPDP_DIR DUMPFILE=file.dmp schemas=rcemca remap_schema=rcemca:rcecms


But i got the following error:

ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation

After some searches i figured out it was because the user oracle, which ultimately runs the necessary steps to import the data, which is different from the user with which i ran the impdp command, has no access to the /home/firman/Downloads directory. A permission problem. This was fixed by changing the permission of /home/firman/Downloads or better still, moving the dump file to the Oracle provided data pump directory, which is DATA_PUMP_DIR (query above).

Installing Oracle Express 11g on CentOS

I tried to install Oracle Express 11g on CentOS following steps in this blog:

http://www.davidghedini.com/pg/entry/install_oracle_11g_xe_on

I installed successfully but i was unable to connect to the database. It kept giving me error:

ORA-01031: insufficient privileges

I found the answer in this forum: http://www.orafaq.com/forum/t/169798/0/

Summary:

yum install libaio bc flex net-tools
add your hostname to /etc/hosts
unzip oracle.zip
cd Disk1
rpm -ivh oracle.rpm
/etc/init.d/oracle-xe configure
usermod -a -G dba username (replace username with any username to access db)

all above must be run as root.

And then add envvar ORACLE_HOME and ORACLE_SID to user's ~/.bash_profile (case sensitive!)

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE

Also add oracle bin to the PATH:

PATH=$PATH:/u01/app/oracle/product/11.2.0/xe/bin

Restart, and now i can log in into sqlplus this way:

sqlplus / as sysdba

I tried to connect to db as user system with the password supplied during oracle-xe configure after installation, i get nasty error saying password invalid. I have to log in as sysdba and set the password of the user system (used in APEX):

alter user system identified by password

And now, setting ssh so i can access my centos from mac.
First check if sshd is already started and listening to port 22:

sudo netstat -tulpn | grep :22

If sshd is already started, then you should see sshd listed there, listening on port 22. If nothing shows up, then start sshd as root:

chkconfig sshd on
service sshd start

Add the following to /etc/sysconfig/iptables if not already present

-A input -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

And restart iptables

service iptables restart

To connect with SSH from mac host to centos guest virtualbox, activate adapter 2 in virtualbox -> settings -> network.

http://aruljohn.com/info/virtualbox-access-guest-from-host-nat/

Choose host only adapter for adapter 2. In the name drop down list, if none is already present, create one from virtualbox preference.

When this is done, run ifconfig as root from inside centos to find out the ip address to connect to. In my case, the ip address is 192.168.56.102.

Now i can ssh to my centos from my mac.

Open port for Application Manager/Apex and ORCL db. These ports are defined in oracle-xe configure after installation. Add entries in iptables (in my case, apex at 10001 and ORCL db at 1521):

-A input -m state --state NEW -m tcp -p tcp --dport 10001 -j ACCEPT
-A input -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT

Restart iptables:

service iptables restart.

Now i can access oracle db (thru SQL developer) and apex (http://192.168.56.102:10001/apex/f?p=4950) from my mac.

On a related thread, another story...
My mac has a meager RAM of only 4GB. I allocated 1 GB to the centos on virtualbox and when i fire up eclipse, firefox, and sql dev on mac host and oracle db on centos gues, my mac goes down to its knees.

I tried to prune the memory allocated to centos to half its installation size. centos still runs well, but ORCL would not start complaining:

ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist.

I tried to fiddle with SGA resizing (init.ora) but none works. I decided to do a fresh reinstall of centos and ORCL.

This time, i created centos virtual machine with RAM 512.

I booted it with centos live CD iso. When i get to the desktop, i clicked "install to hard disk" icon. But nothing happened. I learned later that centos would not install thru GUI at 512 MB RAM. So i had to sudo and run the executable symlinked by the install to hard disk icon.

I got a centos installation without GUI. Oracle installation succeeded, but sqlplus would not start with error message of inssuficient permission. I would be happy to have CLI centos and lean ORCL on it, but i simply did not have time to fiddle to get it to work. So i decided to reinstall centos with 768 MB. GUI installation worked, and i get to the above steps.

I will try to find out what cause ORCL to refuse to start when in centos no GUI mode. When i have time. Which is very likely never going to happen. .-))