23 November 2005

How to export from oracle to spool text using SQL Navigator

Since my job now need me to convert back from oracle to Cobol text file, i just publish the easiest way to export your data to spool text file.
Scenario.

RDB Table:
TEST
Column :
name (varchar2 - 255),
account(varchar2 - 255),
address(varchar2 - 255),
oldacc(varchar2 - 255)

From Cobol Data Library:
Length:
Record Length: 40
name (10)
account (5)
address (20)
oldacc (5)
From Cobol Data Library, i need to convert from oracle to text file by follow the exact length of column(field).

In this note I will use SQL Navigator as tool.
Make a select statement like this:
SELECT lpad( DECODE (a.name,null,' ',a.name),10,' ')||
rpad( DECODE (a.account,null,' ',a.account),5,' ')||
rpad( DECODE (a.address,null,' ',a.address),20,' ')||
rpad( DECODE (a.oldacc,null,' ',a.oldacc),5,' ')
from TEST a
SQL Navigator will return this

LPAD(DECODE(A.NAME,NULL,'',A.NAME),10,'')||RPAD(DECODE(A.ACCOUNT,NULL,'',A.ACCOUNT,5,'')||RPAD(DECODE(A.ADDRESS,NULL,'',A.ADDRESS),20,'')||RPAD(DECODE(A.OLDACC,NULL,'',A.OLDACC),5,'')

Micheal 12345Block A, Street SmartA0123
Then export the result to your spool text.
Keep in mind this export procedure can be different depend on your scenario.

22 November 2005

Accidentally Deleted Datafile

Once upon a time i Ramadhan, there were an introduction session to oracle structure conducted by Boss. In that session, Boss keep remind us.
"Don't you ever delete the datafile through operating system level because it will make your database cannot start. The reason is the user in the database is tagged with particular datafile"
Something magic was happened that night where we - Boss and Me (read Boss) proudly deleted by typed this bloody command in Linux AS Server.
rm -rf datafile01.dbf
Hahahahaha... that's the magic.

The final solution is to ask Mr Tom, "To Tom...we have a little bit problem here. Our Oracle 10G cannot start because we accidentally deleted the datafile"

Mr Tom didn't respond to our problem.

Ok let's go to Mr Google. The same question to Mr Google. And Mr Google reply please visit this page.

To whom it may concern:

1. Don't delete datafile by OS level.
2. Don't delete datafile by OS level.
3. Don't delete datafile by OS level.
4. Always keep in mind Mr Tom is your friend in Oracle
5. Mr Tom is not Mr Google's friend