One can find out dbid of a database through various means :
a) Execute a query, if db is either in mount mode or open
SQL> select dbid from v$database ;
b) If the db is is nomount mode but connected to recovery catalog, then you can find out while connected to Recovery Catalog
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
——- ——- ——– —————- — ———- ———-
1 18 PRIMDB 555044608 PARENT 1 09/18/2011 17:33:42
1 19 PRIMDB 555044608 PARENT 787897 05/23/2015 20:01:07
1 20 PRIMDB 555044608 PARENT 1098108 06/10/2015 18:22:30
1 2 PRIMDB 555044608 CURRENT 1115148 06/11/2015 03:44:36
DISCLAIMER : Do not attempt this on critical or Production System.
I run multiple VirtualBox hosting Oracle Linux with Oracle database. It’s like a playground for me to do lot of oracle stuff.
Every time I have to take a connection , It’s painful to enter id/pwd for these so called playground system.
Started doing a little search as to how other fellow DBAs are getting away with this issue. Here is a little cheat trick that can be applied on non-critical systems.
Putty doesn’t give you an option to store password, but it does give you an option to store user name. Refer to below screenshot.
Assuming user ‘neeraj’ was already created in Oracle Linux O/S , let take a connection by specifying password
Let’s create a dir .ssh into /home/neeraj
Next challenge is how to avoid entering password everytime a connection is established to OL ( Oracle Linux ) via account ‘neeraj’
Here is a little cheat trick
Download Putty Keygen software from this url andopen the same. Keep settings as show below.
Click on generate button and randomly move mouse on blank area to generate a random key. Within a min, you would see similar to this
Click “Save Private Key button” and save Private key on local drive.
Note : If anyone get hold of this Private key, they can access your Virtual Machine running within VirtualBox without the need to enter id/pwd.
Next step is to open saved Private key ( C:\Misc_Things\test.ppk ) in notepad and copy the lines that represent PUBLIC key in clipboard
Since there are 3 lines , make sure to combine all line and create sort of single line which represents Public Key.
Since your putty session via ‘neeraj’ account is still active , go into following dir /home/neeraj/.ssh/
and create a file called authorized_keys and paste that 1 line which represents public key
Notice we have to insert ” ssh-rsa ” in front of our public key. There is a space in front and end of keyword ssh-rsa. Click on above screenshot to see a large image file
Now configure existing putty connection to use Private Key as shown below
Now take a fresh connection …. Voilla as seen in below screenshot , we dint had to enter pwd , it utilized Private/Public key and authenticated our dummy account ‘neeraj’
Recently I broke VirtualBox Guest Addition within my OracleLinux box and was not sure what version am I really running.
Here goes a simple command to check version
[root@pr ~]# modinfo vboxguest
At times we have to invoke some sort of gui client ( let’s say Oracle Installer etc ) from putty. It can be a pain to have it started, but if things are configured properly it’s not that difficuilt.
For this exercise, we would require following software
A free open source based terminal emulator through which you can connect to your unix, linux box
You can download it from here for free
2) Xming X Server for Windows ( To be installed on local machine )
Again this is also based on open source , it’s a leading X Server for windows. You can download it from here for free
Configuring Xming Server
After you are done with Xming Server installation on your Win ( Win 7 in my case ) , we need to configure it by invoking Xlaunch from Xming Menu.
Here are some of the screenshots that shows you how to configure the Xming
Hit Save Configuration button & then Finish
Configuring Putty Client for Xming
Now we need to configure putty, assuming you already know your Unix/Linux Server hostname or ip address, here are the steps to configure Xming
Change the value for scrollback to a desired bigger no.
Make sure “Enabling X Forwarding is selected” with a value of localhost:0
Now go back to sessions option that appear on left and save this putty configuration
Now we just need to invoke Xming Server from Start Menu.
Go to Start Menu — > All Programs –>Xming —> Xming
This will bring Xming in taskbar next to windows clock
Take a connection through putty to your linux/Unix Server and after entering credentials type in xclock. It should come up like shown below
If you want to run xclock in the background, invoke following command
instead of just
So far this works great, but what i observed was as soon as shifted to oracle user on unix it stopped working it gave me this error
[oracle@pr ~]$ xclock
Xlib: connection to “localhost:11.0” refused by server
Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match
Error: Can’t open display: localhost:11.0
For this there is a workaround, hift back to root account and issue following command
You might see just 1 line depending upon how many keys are present in xauth. In my case there are 3 keys
Copy the last line into clipboard
pr.localhosts.localdomain/unix:11 MIT-MAGIC-COOKIE-1 51da8af273156d606b3080213fae200d
Switch to Oracle account via su – oracle
and issue following command
xauth add pr.localhosts.localdomain/unix:11 MIT-MAGIC-COOKIE-1 51da8af273156d606b3080213fae200d
Basically i added key to xauth
and now you are all set and you wont get this error atleast in current session
Oracle recyclebin works pretty much works same like windows recyclebin. Concept was introduced by Oracle in 10g. It’s a pretty useful feature .. let’s say in a situation where you have dropped a table and you want to restore that table without performing db recovery.
You can check if Recyclebin is enabled or not by checking following parameter
SQL> show parameter recyclebin;
Let’s see how it works by creating a dummy user and granting him role to connect
SQL> create user john identified by john;
SQL> grant connect, resource to john;
Below is the list of tables that you can use to query information about recyclebin
If you are connected via john and you dropped something, then you can query user_recyclebin.
Check if something is there in recyclebin or not
select * from user_recyclebin;
Let’s create a table,, insert few records into it.
SQL> create table john.sales ( versioninfo varchar(30), insertdate date);
SQL> insert into john.sales values (‘v1’, sysdate);
Now let’s drop the table ..
SQL> drop table john.sales ;
Above statement will drop the table, behind the scenes, it’s just renaming the table sales and putting it in recyclebin. Above statement doesn’t release the space occupied by Table.
Let’s query our recyclebin and see what is sitting there now.
As we saw in above screenshot, object just got renamed to BIN$something.
If you want to permanent delete this table from recyclebin then just issue following SQL Statement
SQL > purge recyclebin;
However, If we want to restore it back from recyclebin, all we have to do it issue following sql statement.
SQL> flashback table john.sales to before drop;
What if, if you would prefer not to send table into recyclebin at the 1st place & delete it permanently. You can issue following SQL statement
SQL> drop table john.sales purge ;
What if, … if i create table sales, then drop it , again create table sales, and then again drop it and repeat this for let’s say 10 times . It will obviously show 10 records in recyclebin starting with BIN$, if you issue SQL command
SQL> flashback table john.sales to before drop;
It would restore the table based on LIFO ( Last In first Out ), however if you want to restore specific version, you can issue following command
SQL> flashback table john.”BIN$2te9VmGlINrgQKjArjhl3A==$0” to before drop;
Replace BIN with the version that you would want to restore.
forums.oracle.com is due for upgrade sometime in April
Was traversing through Oracle Enterprise Linux file structure and realized that by default it doesn’t show me what dir I am sitting in unless and until I execute ‘pwd’ command
To display DIR info. at Linux prompt , I just added the following to the systemwide configuration file /etc/bashrc:
# customized prompt with full path of working dir
PS1=”[\u@\h \w]\\$ “