Tuesday, April 30, 2013

Xlib: connection to ":3.0" refused by server Xlib: No protocol specified


This is a soluation for the problem  Xlib: connection to ":0.0" refused by server - X ;


 Hi, I can't run any program . getting this  Xlib: connection to ":0.0" refused by server Xlib: No protocol specified xeyes Xlib: connection to ":0.0" refused by server Xlib: No protocol



[oracle@hostname ~]$ dbca
Xlib: connection to ":3.0" refused by server 
   Xlib: No protocol specified

Need to login with the user not root....

[oracle10@db01 ~]$ vi ~/.vnc/xstartup
[oracle10@db01 ~]$ vncserver
You will require a password to access your desktops.
Password: type new password
Verify: retype
--(xauth:  creating new authority file /usr/oracle/.Xauthority
New 'db01.ct.com:3 (oracle10)' desktop is db01.ct.com:3 ,Creating default startup script /usr/oracle/.vnc/xstartup
Starting applications specified in /usr/oracle/.vnc/xstartup
Log file is /usr/oracle/.vnc/db01.ct.com:3.log)

[oracle10@db01 ~]$ vi ~/.vnc/xstartup

Uncomment  both the parameter  (# remove the hash sign  starting both of the line)
unset SESSION_MANAGER
 exec /etc/X11/xinit/xinitrc

 [oracle10@db01 ~]$ service vncserver start
-bash: service: command not found

[oracle10@db01 ~]$ vncserver
New 'db01.ct.com:4 (oracle10)' desktop is db01.ct.com:4
 Starting applications specified in /usr/oracle/.vnc/xstartup
 Log file is /usr/oracle/.vnc/db01.ct.com:4.log

[oracle10@db01 ~]$ dbca
now dbca will run successfully.......



All The Best........:)

Saturday, February 9, 2013

Move a table from one tablespace to another

There are many ways to move a table from one tablespace to another. For example,

ORA-01502: index 'MANU.SYS_C0010803' or partition of such index is in unusable state

conn with sys
see the tablespace

SQL> select tablespace_name,contents from dba_tablespaces;
TABLESPACE CONTENTS
---------- ---------
SYSTEM           PERMANENT
UNDOTBS1     UNDO
SYSAUX          PERMANENT
TEMP             TEMPORARY
USERS           PERMANENT
EXAMPLE    PERMANENT
AD                PERMANENT
AD12             TEMPORARY
8 rows selected.

see the default tablespace of the users

SQL> select username,default_tablespace from dba_users;
USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
MDSYS                          SYSAUX
ORDSYS                         SYSAUX
EXFSYS                         SYSAUX
DMSYS                          SYSAUX
DBSNMP                         SYSAUX
SCOTT                          USERS
WMSYS                          SYSAUX
TSMSYS                         USERS
MANU                           AD
BI                             USERS
PM                             USERS

-----to see the tables in the tablespace;

SQL> col owner format a10
SQL> col segment_name format a15
SQL> col tablespace_name format a10

SQL> select owner,segment_name,tablespace_name,segment_type from dba_segments where owner='MANU';
OWNER      SEGMENT_NAME    TABLESPACE SEGMENT_TYPE
---------- --------------- ---------- ------------------
MANU       AD              AD         TABLE
MANU       DEPT            AD         TABLE
MANU       EMP             AD         TABLE


----now change the default tablespace ad into users---

SQL> alter user manu default tablespace users quota unlimited on users;

SQL> select username,default_tablespace from dba_users where username='MANU';

USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
MANU                           USERS

manu's tables are in the ad tablespace and now i want to transfer into the one tablespace "users"

SQL> select owner,segment_name,tablespace_name,segment_type from dba_segments where owner='MANU';

OWNER      SEGMENT_NAME    TABLESPACE SEGMENT_TYPE
---------- --------------- ---------- ------------------
MANU       AD              AD         TABLE
MANU       DEPT            AD         TABLE
MANU       EMP             AD         TABLE

--move the table from ad tablespace to users tablespace---

SQL> alter table manu.ad move tablespace users;

Table altered.

SQL> alter table manu.emp move tablespace users;

Table altered.

SQL> alter table manu.dept move tablespace users;

Table altered.

SQL> select owner,segment_name,tablespace_name,segment_type from dba_segments where owner='MANU';

OWNER      SEGMENT_NAME    TABLESPACE SEGMENT_TYPE
---------- --------------- ---------- ------------------
MANU       AD              USERS      TABLE
MANU       DEPT            USERS      TABLE
MANU       EMP             USERS      TABLE

Enter user-name: sys as sysdba
Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SELECT 'ALTER INDEX '||OWNER||'.'||INDEX_NAME||' REBUILD;' FROM DBA_INDEXES WHERE STATUS = 'UNUSABLE';

'ALTERINDEX'||OWNER||'.'||INDEX_NAME||'REBUILD;'
--------------------------------------------------------------------------------
ALTER INDEX MANU.SYS_C0010803 REBUILD;
ALTER INDEX MANU.INDX REBUILD;

SQL> ALTER INDEX MANU.SYS_C0010803 REBUILD;

Index altered.

All the best ....... :)

Wednesday, February 1, 2012

to find the 2nd hightest salary

SQL> select employee_id,salary from employees  e where
  2  2 =(select count(distinct salary) from employees  where e.salary<=salary)
  3  /
output
EMPLOYEE_ID     SALARY
----------- ----------
        101      17000
        102      17000


all the best.....

Monday, October 17, 2011

Manually corrupting the data block in Linux and recovering it using BLOCKRECOVER command of RMAN

Manually corrupting the data block in Linux and recovering it using BLOCKRECOVER command of RMAN
Sometimes, in order to test the RMAN’s  BLOCKRECOVER command, we need to corrupt the specific data block and recover it for testing purpose.
To do it in Linux, use dd command. In the following example, let’s create a table and corrupt it manually
 (Don’t try it on the production database  or you’ll be fired work from the job )


SQL> create table manu (id number ,name char(15));
Table created.

SQL> insert into manu values(1,'tanu');
1 row created.

SQL> commit;
Commit complete.

SQL> select * from manu;
        ID   NAME
———-------
         1   tanu


SQL> select header_blockfrom dba_segments where segment_name=’MANU’;
HEADER_BLOCK
————
          61201

[oracle@localhost ~]$ dd of=/u01/app/oradata/orcl/system01.dbf bs=8192 conv=notrunc seek=61202 << EOF
> testing corruption
> EOF
0+1 records in
0+1 records out


SQL> ALTER SYSTEM FLUSH BUFFER_CACHE;
System altered.


SQL> select * from manu;
select * from manu
                     *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 1, block # 61202)
ORA-01110: data file 1: ‘/u01/app/oradata/orcl/system01.dbf’

SQL>

Now connect to the RMAN and recover the data block (not the whole datafile or database) using BLOCKRECOVER command as follows:
SQL> ! rman target /
RMAN>

RMAN>blockrecover datafile 1 block 61202;
Starting blockrecover at 15-OCT-11
<… underprocess … >
<… underprocess … >

Finished blockrecover at 15-OCT-11
RMAN> exit

Connect to SQL*Plus and query the table:SQL> select * from manu;
        ID NAME
———--------
         1     tanu




ALL THE BEST TO ALL...... :)

Saturday, September 17, 2011

ORA-00600: internal error code, arguments: [kcratr1_lastbwr]

Some time we encounter this error while starting the database.
Below is the solution for recovering through this error.

Error:

SQL> startup
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size  83888372 bytes
Database Buffers 79691776 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-00600: internal error code, arguments: [kcratr1_lastbwr], [], [], [], [],[], [], []


Cause:

Oracle is unable to perform instance recover but it works when is invoked manually.

Solution:

SQL> startup mount
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 83888372 bytes
Database Buffers 79691776 bytes
Redo Buffers 2973696 bytes
Database mounted.

SQL> recover database

Media recovery complete.
SQL> alter database open;
Database altered.

All The Best ............




Thursday, June 2, 2011

Database Startup fails with ORA-00444, ORA-07446

Problem Description
When I start my database my instance fails with ORA-00444 and ORA-07446 as follows.


SQL> startup
ORA-00444: background process "MMAN" failed while starting
ORA-07446: sdnfy: bad value '' for parameter.



Cause of The Problem
Database startup event is logged into alert log file. And alert log file is defined by the background_dump_dest parameter inside the initialization parameter. While starting up the instance if instance fail to write into the alert log file then instance crushes and fail to startup.

Solution of The Problem
There may be different scenario whenever oracle fails to write alert log contents. Suppose the partition reside alert log file is full. In that case delete/move unnecessary file from the alert log partition directory.

There may be the case the the directory defined by the background_dump_dest does not exist in the OS.

In both case you may also like to change the background_dump_dest location inside the pfile.

If you have spfile then,
1.create pfile='/u01/abc.ora' from spfile;
2.edit the pfile /u01/abc.ora
3.Modify the background_dump_dest to a valid location and in a patition where there is sufficient space available.
4.start the database isntance.
startup pfile=' /u01/abc.ora';
5.create spfile again.
create spfile from pfile= '/u01/abc.ora';

Thursday, April 21, 2011

DIM-00014: Cannot open the Windows NT Service Control Manager. O/S-Error: (OS 5) Access is denied.

This error is common in Windows Vista and windows 7 .
Its means that the user from which you are using oradim has not sufficient privileges .But most of the users complaint that they are performing this task from Administrator user or they have only one account in windows and its administrator ,but still they are facing this problem .
So the solution is very simple ,
just go to start wirte cmd ,cmd icon appears ,right click on it ....
Then click on "Run as administrator" and then create your required service .


oradim -new -sid myservice ;