#this will run the command with another user's environment and account.
sudo -i -u username command
Reference
http://linux.die.net/man/8/sudo
Thursday, December 20, 2012
compare strings in bash shell script
if [ $1 == $2 ] ; then
echo "Equal"
else
echo "not equal"
fi
if [ $1 != $2 ]; then
echo "not equal"
else
echo "equal"
fi
if [ $1 == "test" ] ; then
echo "Equal"
else
echo "not equal"
fi
reference:
http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/
echo "Equal"
else
echo "not equal"
fi
if [ $1 != $2 ]; then
echo "not equal"
else
echo "equal"
fi
if [ $1 == "test" ] ; then
echo "Equal"
else
echo "not equal"
fi
reference:
http://www.tech-recipes.com/rx/209/bournebash-shell-scripts-string-comparison/
Thursday, December 13, 2012
ORA-14048: by Alter index unusable usable : IMPORT
PROBLEM:
when importing schema to database (version 11.2.0.3 linux 64bit) using data pump, Below errors appeared in log.
ORA-39083: Object type CONSTRAINT failed to create with error:
ORA-14048: a partition maintenance operation may not be combined with other operations
Failing sql is:
ALTER INDEX "TEST"."SYS_C001906177" UNUSABLE ENABLE
CAUSE:
This is unpublished bug 4919496. When schema was exported, system generated index was put into unusable state. So export generate the "alter index .... unusable; enable" statement in dump file. this can be proved by generate SQLFILE using import tool.
SOLUTION:
the error can be ignored during importing. To avoid this error, make system generated index usable when doing export.
reference:
Import Fails With Error ORA-14048 A Partition Maintenance Operation May Not Be Combined With Other Operations [ID 787407.1]
when importing schema to database (version 11.2.0.3 linux 64bit) using data pump, Below errors appeared in log.
ORA-39083: Object type CONSTRAINT failed to create with error:
ORA-14048: a partition maintenance operation may not be combined with other operations
Failing sql is:
ALTER INDEX "TEST"."SYS_C001906177" UNUSABLE ENABLE
CAUSE:
This is unpublished bug 4919496. When schema was exported, system generated index was put into unusable state. So export generate the "alter index .... unusable; enable" statement in dump file. this can be proved by generate SQLFILE using import tool.
SOLUTION:
the error can be ignored during importing. To avoid this error, make system generated index usable when doing export.
reference:
Import Fails With Error ORA-14048 A Partition Maintenance Operation May Not Be Combined With Other Operations [ID 787407.1]
Tuesday, December 11, 2012
Password in Oracle 11G
ISSUE:
When we move schemas in one database or from it to another by datapump, we sometimes can not login to moved schemas with its password.
CAUSE:
Password has version (10G or 11G) in 11G database. Version usage is controlled by parameter.
HASH PROCESS:
a. in 10G
passphrase + username are used to generate hash
b. in 11G
passphrase + salt are userd to generate hash.
c. sec_case_sensitive_logon parameter is used to control password authentication method.
sec_case_sensitive_logon -> TRUE : 11G authentication
sec_case_sensitive_logon -> FALSE : 10G authentication
SYNOMINAL:
move schema TEST (11G) to TEST1 (10G) : need reset pass
move schema TEST (11G) to TEST (10G) : might need reset pass if 10G hash value is not correct
move schema TEST (11G) to TEST1 (11G): no need to reset pass
move schema TEST (11G) to TEST (11G): no need to reset pass
move schema TEST (10G) to TEST (10G) : no need to reset pass
move schema TEST (10G) to TEST1 (10G) : need reset pass
move schema TEST (10G) to TEST (11G) : might need reset pass if 11G hash value is not null or correct
move schema TEST (10G) to TEST1 (11G) : need reset pass if 11G hash value is not correct
EXPLANATION:
Two hash values are stored in 11G database. One is for back-track to 10G pass authentication and the other one for new 11G authentication.
to check what hash was stored:
select username, password_versions from dba_users;
results can be:
10G
11G
10G 11G
to check the hash values
select name, password,spare4 from sys.user$;
password column is 10G hash value
spare4 column is 11G hash value(3-42) and its salt harsh value(43-63)
Reference:
http://www.notesbit.com/index.php/scripts-oracle/oracle-11g-new-password-algorithm-is-revealed-by-seclistsorg/
http://www.petefinnigan.com/sha1.sql
http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_1101.htm#sthref3208
http://askdba.org/weblog/2008/11/how-to-changerestore-user-password-in-11g/
When we move schemas in one database or from it to another by datapump, we sometimes can not login to moved schemas with its password.
CAUSE:
Password has version (10G or 11G) in 11G database. Version usage is controlled by parameter.
HASH PROCESS:
a. in 10G
passphrase + username are used to generate hash
b. in 11G
passphrase + salt are userd to generate hash.
c. sec_case_sensitive_logon parameter is used to control password authentication method.
sec_case_sensitive_logon -> TRUE : 11G authentication
sec_case_sensitive_logon -> FALSE : 10G authentication
SYNOMINAL:
move schema TEST (11G) to TEST1 (10G) : need reset pass
move schema TEST (11G) to TEST (10G) : might need reset pass if 10G hash value is not correct
move schema TEST (11G) to TEST1 (11G): no need to reset pass
move schema TEST (11G) to TEST (11G): no need to reset pass
move schema TEST (10G) to TEST (10G) : no need to reset pass
move schema TEST (10G) to TEST1 (10G) : need reset pass
move schema TEST (10G) to TEST (11G) : might need reset pass if 11G hash value is not null or correct
move schema TEST (10G) to TEST1 (11G) : need reset pass if 11G hash value is not correct
EXPLANATION:
Two hash values are stored in 11G database. One is for back-track to 10G pass authentication and the other one for new 11G authentication.
to check what hash was stored:
select username, password_versions from dba_users;
results can be:
10G
11G
10G 11G
to check the hash values
select name, password,spare4 from sys.user$;
password column is 10G hash value
spare4 column is 11G hash value(3-42) and its salt harsh value(43-63)
Reference:
http://www.notesbit.com/index.php/scripts-oracle/oracle-11g-new-password-algorithm-is-revealed-by-seclistsorg/
http://www.petefinnigan.com/sha1.sql
http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_1101.htm#sthref3208
http://askdba.org/weblog/2008/11/how-to-changerestore-user-password-in-11g/
Subscribe to:
Posts (Atom)