Sie sind auf Seite 1von 6

How can i connect to the remote database? Server side --------------We have to check the server.

The server database is prd sql>select * from all_users; 10 Database side one process must be up and running i.e listener process. If listener is not there u have to create and configure a listener. listener is a server process which handles initial connection request from the client. In server we can create a listener by using the $netca create default listener name is LISTENER open listener.ora keep first 5 lines (in the first set) -->brackets not included keep 4 lines in the second set. -->brackets not included

HOST better to user ip in listener.ora file.

IN the first set SID_NAME=prd #su - oracle $ps -ef|grep ora_ here u will find database name You have to reconfigure the listener. $lsnrctl reload (This command will do bouncing) or $lsnrctl stop nad $lsnrctl start The server ip is 192.168.1.2

$sqlplus '/as sysdba' sql>select * from all_users; 10 users Client side -----------client ip is 192.168.1.1 #ping 192.168.1.1 (local client is working)

check with other system i.e server #ping 192.168.1.2 server side also u have to check #ping 192.168.1.1 client side -----------open listener.ora in the client side if it is not available open $netca select Local net service name configuration (select 3 rd option) service name: prd hostname: 192.168.1.2 (server ip) select do not test (will test later) Net service name: to_prd (anything u can give) open tnsnames.ora in the client side everthing is ok tnsping will check connectivity between client to listener admin]$tnsping to_prd from client: $sqlplus usrname/password@connectstring; $sqlplus harish/harish@to_prd; connected. here harish exist in the server.

sql>show user; harish sql>crate teble demp ( a number) sql>select * from tab; 3 tables. sql>conn amit/amit@to_prd; sql>show user amit In os level $sqlplus amit/amit@to_prd; sql>show usr; AMIT $sqlplus system/manager@to_prd; sql>show user; SYSTEM To perform administrative tasks from the client server side must contain password file. what is a password file? password is a file contains password for the privileged user (i.e user will have a sysdba privilege or sysoper privilege) password file lets user to access database and perform adminstrative operations (starup , shutdown etc ) from remotely the default location is dbs di rectory. The password file is only for SYS user. server side: -----------How to create a password file -----------------------------$cd $ORACLE_HOEM/dbs syntax: dbs]$orapwd File=orapw<sid> password=anything eg: dbs]$orapwd File=orapwprd password=prd

client side: --------------syntax: $sqlplus sys/password@connectid as sysdba; $sqlplus sys/prd@to_prd as sysdba; sql>select * from v$pwfile_users; This will query will tell u Who is having sysdba privilege. USERNAME SYSTEM SYSOP ---------------------------------------SYS TRUE TRUE iF U want to give access to other user in server side sql>conn /as sysdba; sql>grant sysdba to SYSTEM; SQL>select * from v$pwfile_users; It is showing two users. SYS In client side -----------------$ps -ef|grep ora_ nothing server side: ----------$sqlplus amit/amit@to_prd as sysdba sql>startup sql> serverside: $ps -ef|grep ora_ it is displaying prd How to make tar file -------------------$tar -cvf prd.tar /home/oracle/prd

go to prd directory remove everything in prd $cd $ORACLE_HOME/dbs $ls nothing is there How to extract from tar file $cd / /]$tar -xvf /home/prd.tar It will open tar file and keep it in the where it is extracted.

$cd oracle/prd prd]$ls everything is there prd]$cp initprd.ora $ORACLE_HOME/dbs prd]$cd prd]$export ORACLE_SID=prd $sqlplus '/as sysdba' sql>starup

How to transfer tarfile from server to client ---------------------------------------------$scp prd.tar 192.168.1.1:/home password: oracle To know the file size $ll -h

In the client side i removed everything from here like all dbf files and everything.

Das könnte Ihnen auch gefallen