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.

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

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;