Thursday, 24 November 2016

Create a schema with a single table

drop user <username> cascade
create user <username> identified by <password>
grant sysdba to <username>
grant all privileges to <username> identified as <password>

create table dbatdb.userinfo(UserId varchar2(50),FirstName varchar2(50),LastName varchar2(50), PRIMARY KEY(UserId));

insert into dbatdb.userinfo (userid,firstname,lastname) values ('userid02','thrilochana','pakkapoti');
insert into dbatdb.userinfo (userid,firstname,lastname) values ('userid03','vasavi','akula');

Sunday, 25 September 2016

$Status

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=database.example.com)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

Friday, 23 September 2016

Some useful database commands for OIM

SQL> select value from v$parameter where name='background_dump_dest';

VALUE
--------------------------------------------------------------------------------
/u0/app/oracle/diag/rdbms/orcl/orcl/trace

-bash-3.2$ cd /u0/app/oracle/diag/rdbms/orcl/orcl/trace
-bash-3.2$ ls
alert_orcl.log       orcl_j001_25686.trm  orcl_ora_20641.trc


QL> show parameter background_dump_dest
To find the location of the diagnostic_dest, can use the following select

SQL> select value from v$parameter where name='diagnostic_dest';

VALUE
--------------------------------------------------------------------------------
/u0/app/oracle
To know the current ORACLE_SID, you can use following select:

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
ORCL
Alert log file consist alert_.log
Therefore my alert log file is : /u0/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log

Sunday, 7 February 2016

If you get this type of error while starting up database using startup command



SQL> startup nomount;
ORA-00845: MEMORY_TARGET not supported on this system


Solution:

Increase tmpfs mount on filesystem to some extent still you overcome MEMORY_TARGET error


mount -t tmpfs shmfs -o size=12g /dev/shm


If you need it permanantly edit "/etc/fstab" and make changes like below

tmpfs                   /dev/shm                tmpfs   size=12g        0 0


Note:

Replace the “defaults” option with the size=12g option.



After saving the file, the changes should be permanent. Now back to Oracle. Let’s see if we can start the database now..

Thursday, 23 July 2015

How to check your database is up or not?

ps -ef |grep pmon

ps -ef|grep $ORACLE_SID|grep -v grep|grep -v ora_|wc -l

ps -ef|grep ${ORACLE_SID}|grep pmon|wc -l

Monday, 28 April 2014

Drop Database



SQL> startup mount exclusive restrict;
ORACLE instance started.

Total System Global Area  730714112 bytes
Fixed Size                  2231952 bytes
Variable Size             721420656 bytes
Database Buffers            4194304 bytes
Redo Buffers                2867200 bytes
Database mounted.

SQL> drop database;

Thursday, 6 March 2014

Disable firewall and SElinux prior to Oracle 11g Database install

Steps:
chkconfig iptables off
chkconfig ip6tables off
service iptables stop
service ip6tables stop
vi /etc/selinux/config
change SELinux=enforcing to SELinux=disabled

reboot