Running GUI via putty

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

1) Putty

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

 

Image

Image

Image

 

Hit Save Configuration button & then Finish

Image

 

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

Image

Change the value for scrollback to a desired bigger no.

Image

Make sure “Enabling X Forwarding is selected” with a value of localhost:0

Image

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

Image

Take a connection through putty to your linux/Unix Server and after entering credentials type in xclock. It should come up like shown below

Image

 

If you want to run xclock in the background, invoke following command

xclock &

instead of just

xclock

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
[oracle@pr ~]$

For this there is a workaround, hift back to root account and issue following command

xauth list

Image

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

Image

 

 

 

Categories: Uncategorized Tags: , , , , , , , ,

Oracle Recyclebin

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

Image

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);

SQL> commit;

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.

Image

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.

 

 

Categories: Uncategorized Tags: , ,

Oracle Forum is due for upgrade in April 2013 …

April 19, 2013 1 comment
Categories: Uncategorized Tags: , ,

Display full path of working directory within the command prompt – OEL

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:
 
 Code:
  # customized prompt with full path of working dir

PS1=”[\u@\h \w]\\$ “

 

 

Image

Categories: Uncategorized Tags: , , , ,

How to enable ftp on VirtualBox

You can transfer file from your local machine to virtual box via shared folders or via ftp.

By default looks like ftp is blocked on Virtual Box

Just inside your guest O/S i.e. VirtualBox Linux go to

/etc/xinetd.d/

and modify gssftp file

Change from ‘Yes’ to ‘No’ for DISABLE column as shown in below screenshot and remove value against “server_args”

ftp

 

 

 

 

 

You can restart ftp service via following command

/etc/init.d/xinetd restart

 

Categories: Linux, Oracle blogroll, Unix Tags: ,

How to check if Linux version is 32 bit or 64 bit

You can use following methods

Use this command getconf LONG_BIT

or use this on unix prompt

uname -m

Categories: Linux, Unix Tags: , ,

Setting up swapspace for Oracle

Sometime we land up in a situation where we have to increase swap space, since Oracle installation expects a certain % of swap space depending upon how much RAM you have allocated to O/S. For example if we have allocated 64 mb of RAM, then we need to specify 128 mb of swap space… again this is not always the case that you have to specify swapsize twice of RAM. It all depends on the OS etc, generally here is a little thumb rule

If you have between 1 and 2G RAM, you need to configure 1.5x RAM for swap space.
For 2 to 8G RAM, swap space has to equal RAM.
For RAM more than 8G, swap needs to be ¾ RAM.

If we need to ad swaps pace, we can either add a new partition of type swap or else we can file which can be used by O/S to be used as swap. I am going to demostrate adding swap space via adding file

How to check how much swapsize is specified via following command ?

# swapon -s

or

# cat /proc/meminfo

If I need to add swap space of let’s say 2 gb, i can issue following ‘dd‘ command

# dd if=/dev/zero of=/swapfile bs=1024 count=2097152

Count 2097152 is calculated via multiplying bs or blocksize of 1024 * 2048 mb

Where,

1) if=/dev/zero : Read from /dev/zero file. /dev/zero is a special file in that provides as many null characters to build storage file called /swapfile.
of=/swapfile : Read from /dev/zero write stoage file to /swapfile.
2) bs=1024 : Read and write 1024 BYTES bytes at a time.
3) count=2097152 : Copy only 2097152 BLOCKS input blocks.

The following command will setup the swap space

# mkswap /swapfile

Activate it via

# swapon/swapfile

There is one small thing still pending, once you reboot the Linux server this information is lost, in order to make it more permanent, we need to add following in /etc/fstab file, this file is primarily responsible for telling Linux that what all devices to mount, just add following line in fstab ( File System Table )

/swapfile               swap                    swap    defaults        0 0

Follow

Get every new post delivered to your Inbox.