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..