Thursday, June 25, 2009

Oracle create database in Linux

so you have installed your oracle 10g in $ORACLE_HOME, as a sysdba Unix user.

Next steps:

edit ~/.bash_profile and add:
export ORACLE_HOME=/opt/oracle/product/10g
export ORACLE_SID=MYSID


start listener:
cd $ORACLE_HOME/bin
lsnrctl start

cp $ORACLE_HOME/dbs/init.ora $ORACLE_HOME/dbs/initMYSID.ora

edit initMYSID.ora and set db_name=MYSID


and set


start database

$ORACLE_HOME/bin/sqlplus / as sysdba

startup nomount

and create database:

create database MYSID;

alter user sys identified by oracle;

alter user system identified by oracle;
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql

if the second fails, then drop the database, create it again,
run
select * from V$DATAFILE
see which one is the .dbf file for SYSTEM,
then run
ALTER DATABASE DATATILE 'full.path.to/somefile.dbf' resize 500M;

then do also
create user YOURAPPLICATIONUSER;
grant create session to YOURAPPLICATIONUSER;
GRANT ALL PRIVILEGES to YOURAPPLICATIONUSER;

also run /opt/oracle/product/10g/sqlplus/admin/pupbld.sql as system (pw manager)


if anything goes wrong, use "startup UPGRADE" and rerun the scripts

Remember also how to drop a database:

shutdown abort;
startup mount exclusive restrict;
drop database;


For ALSB, sqlplus and login as your application user and run
@/opt/bea/alsb/3.0/alsb_3.0/dbscripts/oracle/reporting_runtime.sql


In the morning, to startup your stuff:
cd $ORACLE_HOME/bin
./lsnrctl start
./sqlplus / as sysdba
startup
exit

then do
./lsnrctl status
to verify that your instance has been dynamically registered (no need to edit listener.ora)




see also:
http://www.tek-tips.com/faqs.cfm?fid=6435

http://www.dba-oracle.com/oracle_create_database.htm

No comments: