http://stackoverflow.com/questions/2980297/how-can-i-use-cpan-as-a-non-root-user
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> .bash_profile
cpanm Module::<module>
Work hard now so I can be lazy later! Who's the laziest? Show your easiest ways to do the hardest tasks!
Wednesday, October 31, 2012
Monday, October 29, 2012
How to test any database link for other schema or the whole database?
Even if you have "create any" and "select any" privileges, you still can't directly test or create database links owned by other schemas.
SQL> select * from dual@SCHEMA.DBLINK;
select * from dual@
SCHEMA.DBLINK
*
ERROR at line 1:
ORA-02019: connection description for remote database not found
But, there are ways to get around it.
Method 1:
By creating an object within the schema like this:
SQL> create view SCHEMA.for_dblink_test_only as select * from dual@SCHEMA.DBLINK;
View created.
If the database link doesn't work, we'll get the error message, in this example, the database link was pointing to the "old" server:
SQL> create view
SCHEMA.
for_dblink_test_only
as select * from dual@SCHEMA.DBLINK_NOWORKING;
ERROR at line 1:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
So, we can generate a script to test all database links:
select 'CREATE VIEW '||owner||'.for_dblink_test_only as select * from dual@'||db_link||';',
'DROP VIEW '||owner||'.for_dblink_test_only;'
from dba_db_links where username is not null;
Or even better, build a procedure to do so.
Method 2:
If you can get execute privilege on sys.dbms_sys_sql, you can also do it without creating any object:
create procedure execute_sql( p_cmd varchar2, p_user varchar2 )
authid current_user
is
l_user_id number;
l_cursor number;
l_result number;
begin
-- fetch userid
select user_id into l_user_id
from dba_users
where username = p_user;
-- parse and execute
l_cursor := sys.dbms_sys_sql.open_cursor;
sys.dbms_sys_sql.parse_as_user( l_cursor, p_cmd, dbms_sql.native, l_user_id, true );
l_result := sys.dbms_sys_sql.execute( l_cursor );
sys.dbms_sys_sql.close_cursor( l_cursor );
end;
/
authid current_user
is
l_user_id number;
l_cursor number;
l_result number;
begin
-- fetch userid
select user_id into l_user_id
from dba_users
where username = p_user;
-- parse and execute
l_cursor := sys.dbms_sys_sql.open_cursor;
sys.dbms_sys_sql.parse_as_user( l_cursor, p_cmd, dbms_sql.native, l_user_id, true );
l_result := sys.dbms_sys_sql.execute( l_cursor );
sys.dbms_sys_sql.close_cursor( l_cursor );
end;
/
If the database link doesn't work, you'll get:
execute
execute_sql('select * from dual@db_link','SCHEMA');
ERROR at line 1:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1306
ORA-06512: at "SYS.EXECUTE_SQL", line 14
ORA-06512: at line 1
If the database link works, you'll get:
execute
execute_sql('select * from dual@db_link','SCHEMA');
PL/SQL procedure successfully completed.
Tuesday, October 23, 2012
Network timeout causing ORA-03113: end-of-file on communication channel
If you have this error from your client connections due to network timeout, try to set
SQLNET.EXPIRE_TIME=10
in sqlnet.ora
Basically it "pings" client every 10 minutes, that small packet resets the network timeout clock.
Here's what Oracle says about this parameter:
http://docs.oracle.com/cd/B28359_01/network.111/b28317/sqlnet.htm#BIIEEGJH
SQLNET.EXPIRE_TIME=10
in sqlnet.ora
Basically it "pings" client every 10 minutes, that small packet resets the network timeout clock.
Here's what Oracle says about this parameter:
http://docs.oracle.com/cd/B28359_01/network.111/b28317/sqlnet.htm#BIIEEGJH
5.2.28 SQLNET.EXPIRE_TIME
Use parameter
SQLNET.EXPIRE_TIME
to specify a time interval, in minutes, to send a probe to verify that client/server connections are active. Setting a value greater than 0 ensures that connections are not left open indefinitely, due to an abnormal client termination. If the probe finds a terminated connection, or a connection that is no longer in use, it returns an error, causing the server process to exit. This parameter is primarily intended for the database server, which typically handles multiple connections at any one time.- It is not allowed on bequeathed connections.
- Though very small, a probe packet generates additional traffic that may downgrade network performance.
- Depending on which operating system is in use, the server may need to perform additional processing to distinguish the connection probing event from other events that occur. This can also result in degraded network performance.
0
0
10
SQLNET.EXPIRE_TIME=10
Tuesday, October 16, 2012
Unix and Dos commands mapping
Not exactly, but sort of, if you need more powerful utilities, using CygWin |
---|
Dos command | Unix command | Notes |
---|---|---|
arp | arp | |
assign | ln | Create a file link |
assign | ln -s | On Unix, a directory may not have multiple links, so instead a symbolic link must be created with ln -s . |
at | at, batch,cron | |
assoc | file | |
attrib | chown,chmod | Sets ownership on files and directories |
cd | cd | |
cd | pwd | cd alone prints the current directory. |
chkdsk | fsck | Checks filesystem and repairs filesystem corruption on hard drives. |
cls | clear | Clear the terminal screen |
copy | cp | |
date | date | |
del | rm | |
deltree | rm -r | Recursively deletes entire directory tree |
dir | ls | "dir" also works on some versions of Unix. |
doskey /h, F7 key | history | The Unix history is part of the Bash shell. |
edit | vi, emacs, etc. | edit brings up a simple text editor in Windows. On Unix, the environment variable EDITOR should be set to the user's preferred editor. |
exit | exit, Control-D | On Unix, pressing the control key and D simultaneously logs the user out of the shell. |
explorer | nautilus, etc. | The command explorer brings up the file browser on Windows. |
fc | diff | |
find | grep | |
ftp | ftp | |
help | man | "help" by itself prints all the commands |
hostname | hostname | |
ipconfig /all | ifconfig -a | The /all option lets you get the MAC address of the Windows PC |
mkdir | mkdir | |
mem | top | Shows system status |
more | more / less | |
move | mv | |
net statistics | uptime | |
nslookup | nslookup | |
ping | ping | |
print | lpr | Send a file to a printer. |
regedit | edit /etc/* | The Unix equivalent of the Windows registry are the files under /etc and /usr/local/etc . |
rmdir | rmdir | |
rmdir /s | rm -r | Windows has a y/n prompt. To get the prompt with Unix, use rm -i . |
set | env | Prints a list of all environment variables. For individual environment variables, set <variable> is the same as echo $<variable> on Unix. |
set Path | echo $PATH | Print the value of the environment variable using set in Windows. |
shutdown | shutdown | Without an option, the Windows version produces a help message |
reboot, shutdown -r | shutdown -r | |
shutdown -s | shutdown -h | Also need -f option to Windows if logged in remotely |
sort | sort | |
systeminfo | uname -a | |
tasklist | ps | "tasklist" is not available on some versions of Windows. See also this article on getting a list of processes in Windows using Perl |
tracert | traceroute | |
tree | find / ls -R | Use tree | find "string" |
type | cat | |
ver | uname -a | |
xcopy | cp -R | Recursively copy a directory tree |
Oracle cross platform migration not working as advertised
According Oracle document, you should be able to convert any data file including those for system tablespaces with RMAN, even the ENDIAN format is different,
http://docs.oracle.com/cd/E11882_01/backup.112/e10643/rcmsynta012.htm
In Oracle Database 10g and later releases,
It works well for non-system (actually should say non-undo) files:
RMAN> convert datafile '/dsk01/oradata/TESTDB/users01.dbf'
FROM PLATFORM = 'Solaris[tm] OE (64-bit)'
TO PLATFORM = 'Linux x86 64-bit'
db_file_name_convert '/dsk01/oradata/TESTDB' '/dsk01/oradata/TESTDB_CVT'
Starting conversion at target at 15-OCT-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input file name=/dsk01/oradata/TESTDB/users01.dbf
converted datafile=/dsk01/oradata/TESTDB_CVT/users01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Finished conversion at target at 15-OCT-12
But not so well for any data files containing undo segments:
RMAN> convert datafile '/dsk01/oradata/TESTDB/system01.dbf'
FROM PLATFORM = 'Solaris[tm] OE (64-bit)'
TO PLATFORM = 'Linux x86 64-bit'
db_file_name_convert '/dsk01/oradata/TESTDB' '/dsk01/oradata/TESTDB_CVT'
Starting conversion at target at 15-OCT-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=212 device type=DISK
channel ORA_DISK_1: starting datafile conversion
input file name=/dsk01/oradata/TESTDB/system01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of conversion at target command on ORA_DISK_1 channel at 10/15/2012 15:17:32
ORA-00600: internal error code, arguments: [ktu_format_nr: rbu mgc failed], [640], [32770], [32896], [], [], [], [], [], [], [], []
Oracle has a bug filed about this situation:
Bug 10409625 - ORA-600 [ktu_format_nr: rbu mgc failed] during RMAN convert datafile [ID 10409625.8] To Bottom
In 11.2.0.3:
RMAN> convert datafile '/dsk01/oradata/TESTDB/system01.dbf'
FROM PLATFORM = 'Solaris[tm] OE (64-bit)'
TO PLATFORM = 'Linux x86 64-bit'
db_file_name_convert '/dsk01/oradata/TESTDB' '/dsk01/oradata/TESTDB_CVT';
Starting conversion at target at 16-OCT-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=23 device type=DISK
channel ORA_DISK_1: starting datafile conversion
input file name=/dsk01/oradata/TESTDB/system01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of conversion at target command on ORA_DISK_1 channel at 10/16/2012 11:39:17
ORA-19928: CONVERT of data files with undo segments between different endian is not supported.
So, we are out of luck. I'd expect Oracle to implement this in probably release 12.2.
http://docs.oracle.com/cd/E11882_01/backup.112/e10643/rcmsynta012.htm
In Oracle Database 10g and later releases,
CONVERT DATAFILE
or CONVERT TABLESPACE
is required in
the following scenarios:-
Transporting data files between platforms for which the value in
V$TRANSPORTABLE_PLATFORM.ENDIAN_FORMAT
differs. -
Transporting tablespaces with undo segments
(typically
SYSTEM
andUNDO
tablespaces, but also tablespaces using rollback segments) between platforms, regardless of whether theENDIAN_FORMAT
is the same or different. Typically, theSYSTEM
andUNDO
tablespaces are converted only when converting the entire database. - Other platform specific data files, (like when converting to or from the hp Tru64 operating system), require additional data file conversion .
CONVERT
is to transport a tablespace into a database
stored in ASM. Native operating system commands such as Linux cp
and Windows COPY
cannot read from or write to ASM disk groups.It works well for non-system (actually should say non-undo) files:
RMAN> convert datafile '/dsk01/oradata/TESTDB/users01.dbf'
FROM PLATFORM = 'Solaris[tm] OE (64-bit)'
TO PLATFORM = 'Linux x86 64-bit'
db_file_name_convert '/dsk01/oradata/TESTDB' '/dsk01/oradata/TESTDB_CVT'
Starting conversion at target at 15-OCT-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile conversion
input file name=/dsk01/oradata/TESTDB/users01.dbf
converted datafile=/dsk01/oradata/TESTDB_CVT/users01.dbf
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Finished conversion at target at 15-OCT-12
But not so well for any data files containing undo segments:
RMAN> convert datafile '/dsk01/oradata/TESTDB/system01.dbf'
FROM PLATFORM = 'Solaris[tm] OE (64-bit)'
TO PLATFORM = 'Linux x86 64-bit'
db_file_name_convert '/dsk01/oradata/TESTDB' '/dsk01/oradata/TESTDB_CVT'
Starting conversion at target at 15-OCT-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=212 device type=DISK
channel ORA_DISK_1: starting datafile conversion
input file name=/dsk01/oradata/TESTDB/system01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of conversion at target command on ORA_DISK_1 channel at 10/15/2012 15:17:32
ORA-00600: internal error code, arguments: [ktu_format_nr: rbu mgc failed], [640], [32770], [32896], [], [], [], [], [], [], [], []
Oracle has a bug filed about this situation:
Bug 10409625 - ORA-600 [ktu_format_nr: rbu mgc failed] during RMAN convert datafile [ID 10409625.8] To Bottom
Description
It is fixed in 11.2.0.3 and above. Unfortunately, the fix is just changing the ORA-600 error into a "more graceful error message":If an ORA-600 [ktu_format_nr: rbu mgc failed] is raised when using RMAN to convert datafiles to a different endian then this might be the bug. Check if any of the datafiles belong to the SYSTEM tablespace, or contain undo blocks. If so, the operation is unsupported and the fix for this bug will cause a more graceful error message (ORA-19928).
In 11.2.0.3:
RMAN> convert datafile '/dsk01/oradata/TESTDB/system01.dbf'
FROM PLATFORM = 'Solaris[tm] OE (64-bit)'
TO PLATFORM = 'Linux x86 64-bit'
db_file_name_convert '/dsk01/oradata/TESTDB' '/dsk01/oradata/TESTDB_CVT';
Starting conversion at target at 16-OCT-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=23 device type=DISK
channel ORA_DISK_1: starting datafile conversion
input file name=/dsk01/oradata/TESTDB/system01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of conversion at target command on ORA_DISK_1 channel at 10/16/2012 11:39:17
ORA-19928: CONVERT of data files with undo segments between different endian is not supported.
So, we are out of luck. I'd expect Oracle to implement this in probably release 12.2.
Subscribe to:
Posts (Atom)