rami.info



Importing An ORACLE Schema Into A Different Schema With A Different Tablespace

Posted in DBA,RDBMS,Software,Sysadmin by Rami on the March 18th, 2007

Change the new user’s default tablespace to the new tablespace:
alter user scott default tablespace newspace;
Revoke the unlimited tablespace and change the new user’s quota to have space only on the new tablespace:
revoke unlimited tablespace from scott;
alter user scott quota unlimited on newspace quota 0 on oldspace;

Do the import.

Generating A Self Signed Certificate For IIS

Posted in Sysadmin,TechNotes,UNIX,Windows by Rami on the March 9th, 2007

Generate the CA key:
openssl genrsa -des3 -out ca.key 1024
Generate the CA certificate:
openssl req -new -key ca.key -x509 -days 1095 -out ca.crt
Generate the IIS certificate by using the CSR generated from IIS:
openssl x509 -req -days 1095 -in certreq.txt -CA ca.crt -CAkey ca.key -CAcreateserial -out cer.crt
Export the CA certificate to DER encoded binary format if needed to be installed on a WM5 device:
openssl x509 -in ca.crt -outform DER -out ca.cer

Solving System Headers Problems When Using sunfreeware.com’s GCC

Posted in Errors,Software,Solaris,Sysadmin by Rami on the August 9th, 2006

When getting an error like:

In file included from /usr/include/sys/signal.h:34,
from /usr/include/signal.h:26,
from /usr/local/lib/perl5/5.8.7/sun4-solaris/CORE/unixish.h:106,
from /usr/local/lib/perl5/5.8.7/sun4-solaris/CORE/perl.h:2220,
from u32align.c:10:
/usr/include/sys/siginfo.h:259: error: parse error before “ctid_t”
/usr/include/sys/siginfo.h:292: error: parse error before ‘}’ token
/usr/include/sys/siginfo.h:294: error: parse error before ‘}’ token
/usr/include/sys/siginfo.h:390: error: parse error before “ctid_t”
/usr/include/sys/siginfo.h:392: error: conflicting types for `__proc’
/usr/include/sys/siginfo.h:261: error: previous declaration of `__proc’
/usr/include/sys/siginfo.h:398: error: conflicting types for `__fault’
/usr/include/sys/siginfo.h:267: error: previous declaration of `__fault’
/usr/include/sys/siginfo.h:404: error: conflicting types for `__file’
/usr/include/sys/siginfo.h:273: error: previous declaration of `__file’
/usr/include/sys/siginfo.h:420: error: conflicting types for `__prof’
/usr/include/sys/siginfo.h:287: error: previous declaration of `__prof’
/usr/include/sys/siginfo.h:424: error: conflicting types for `__rctl’
/usr/include/sys/siginfo.h:291: error: previous declaration of `__rctl’
/usr/include/sys/siginfo.h:426: error: parse error before ‘}’ token
/usr/include/sys/siginfo.h:428: error: parse error before ‘}’ token
/usr/include/sys/siginfo.h:432: error: parse error before “k_siginfo_t”
/usr/include/sys/siginfo.h:437: error: parse error before ‘}’ token

It’s possible to solve the problem using:

cd /usr/local/lib/gcc-lib/sparc-sun-solaris2.10/3.3.2/install-tools
./mkheaders

10 on 10

Posted in RDBMS,Software,Solaris,Sysadmin by Rami on the August 7th, 2006

To install Oracle 10g on Solaris 10 do the following:

  • Add the SUNWi15cs and the SUNWi1cs packages.
  • Create the needed groups:

groupadd -g 100 oinstall
groupadd -g 101 dba

  • Create the oracle user:

useradd -u 100 -g 100 -G 101 -d /data/oracle -m -s /bin/tcsh oracle

  • Create the oracle project:

projadd oracle

  • Edit /etc/user_attr and add the following:

oracle::::project=oracle

  • Set the max.shm.memory and max.sem.ids for the project:

projmod -s -K "project.max-shm-memory=(priv,4gb,deny)" oracle
projmod -s -K "project.max-sem-ids=(priv,100,deny)" oracle

  • Edit /etc/system and add the following:

set noexec_user_stack=1

  • Reboot
  • Install ORACLE using the installer by running the following:

./runInstaller -ignoreSysPrereqs

  • Enjoy

Cloning A Drive Under Solaris

Posted in Solaris,Sysadmin by Rami on the May 15th, 2006

1. Find the device names of the source and destination drives:
format < /dev/null

2. run the following sh script:
SRC=c0t0d0
DEST=c0t1d0
MOUNTDIR=/clone
SLICES="s0 s1 s2 s3 s4"
mkdir ${MOUNTDIR}
prtvtoc /dev/rdsk/${SRC}s2 > /tmp/vtoc
fmthard -s /tmp/vtoc /dev/rdsk/${DEST}s2
installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/${DEST}s2
# OR installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/${DEST}s0
for i in $SLICES; do
newfs /dev/dsk/${DEST}${i} < /dev/null
mount /dev/dsk/${DEST}${i} ${MOUNTDIR}
cd ${MOUNTDIR}
ufsdump 0f - /dev/dsk/${SRC}${i}| ufsrestore rf -
cd /
umount ${MOUNTDIR}
done
rmdir ${MOUNTDIR}
rm /tmp/vtoc

Updating Solaris 10

Posted in Solaris,Sysadmin by Rami on the May 15th, 2006

In order to update Solaris 10 with the latest OS updates the following is needed to be done:

1. Create a file /tmp/registration.properties with the following:
userName=sunusername
password=sunpassword
hostName=
subscriptionKey=
portalEnabled=false
proxyHostName=
proxyPort=
proxyUserName=
proxyPassword=

2. Run the following command:
sconadm register -a -r /tmp/registration.properties

3. To perform the update do the following:
smpatch update

Calling JAVA code from Oracle

Posted in RDBMS,Software,TechNotes by Rami on the March 19th, 2006

To run java code from oracle do the following:

1. Create the java code on the server:

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "hello" AS
public class hello {
public static String world() {
return "Hello World";
}
}
/

2. Create the oracle function on the server:

CREATE OR REPLACE FUNCTION hellofunction RETURN VARCHAR2 AS
LANGUAGE JAVA NAME 'hello.world() return java.lang.String';
/

3. Call the function using a SELECT:

SELECT hellofunction() from DUAL;

root.cache Update

Posted in AtWork,Sysadmin by Rami on the March 15th, 2006

Update root.cache or named.ca files for DNS servers using the following command:

dig @a.root-servers.net. . ns

UPDATE: a better command:

dig +bufsize=1200 +norec NS . @a.root-servers.net > /var/named/named.root [Link]

Look at what I’ve got

Posted in Gadgets,Gifts by Rami on the March 8th, 2006

 

And it’s from my wife :o)

URLEncode And URLDecode For Perl

Posted in Code,Perl by Rami on the November 19th, 2005

PHP has builtin functions for urlencode and urldecode functions but for perl I’ve found the following from HERE that does the same thing:

sub URLDecode {
my $theURL = $_[0];
$theURL =~ tr/+/ /;
$theURL =~ s/%([a-fA-F0-9]{2,2})/chr(hex($1))/eg;
$theURL =~ s/<!--(.|\n)*-->//g;
return $theURL;
}

sub URLEncode {
my $theURL = $_[0];
$theURL =~ s/([\W])/"%" . uc(sprintf("%2.2x",ord($1)))/eg;
return $theURL;
}

Next Page »