Skip to content

Monthly Archives: July 2007

Recompiling database objects

The DBMS_UTILITY package has a function called compile_schema that compiles all procedures, functions, packages, and triggers.

EXEC DBMS_UTILITY.compile_schema(schema => ‘SCOTT’);

You can also use the UTL_RECOMP package, but I haven’t tried that one yet.
With thanks to this ORACLE-BASE article.

Korn shell way of checking if environment variable is set

Sometimes you have to check if a variable is set and exit if it’s not. The following code does it in a nice and simple way :

error_mess="This environment variable should be set"
 
: ${ORACLE_HOME:?$error_mess}

The output looks like this :

./script.sh[3]: ORACLE_HOME: This environment variable should be set

The script exits after checking [...]

Statspack summary

This post is a summary of the Oracle Statspack Survival Guide.
To install statspack :

Create tablespace for it
@?/rdbms/admin/spcreate (run as sysdba)

To take snaps :

exec statspack.snap;

To create the report :

@?/rdbms/admin/spreport.sql

Automating FTP

Here’s how you automate FTP :

ftp -v -n hostname << EOF
user usuario password
bin
put filename
bye
EOF

With thanks to this post.