Archive for the ‘code’ category

Oracle Database Admin Lecture 15 (import/export) & HW4 (show paths)

May 6th, 2010

Hi All,

Here are my notes from last night’s lecture. We covered exporting and importing data to/from Oracle. I ended up taking 10 pages of notes. Holy Cow! Also, below I’ve pasted the source code for Homework number 4 … It’s a script which tells you the paths to various files important to Oracle DBAs (table_spaces and control_files and spfiles ….).

Lecture 15

I took a pretty bare-bones approach to this one … Didn’t even end up formatting my output (c’est la vie). Nevertheless, it totally works (scroll below the source if you would like to see the outputs).

SAMPLE OUTPUT:

****************************************************************
/home/sstephe2> ./ora_info.rb -t
tablespace names and path:
/oracle/oradata/orcl/users01.dbf
USERS

/oracle/oradata/orcl/undotbs01.dbf
UNDOTBS1

/oracle/oradata/orcl/sysaux01.dbf
SYSAUX

/oracle/oradata/orcl/system01.dbf
SYSTEM

/oracle/oradata/orcl/example01.dbf
EXAMPLE
****************************************************************
/home/sstephe2> ./ora_info.rb -r
redologfile names and path:
3 ONLINE
/oracle/oradata/orcl/redo03.log
NO

2 ONLINE
/oracle/oradata/orcl/redo02.log
NO

1 ONLINE
/oracle/oradata/orcl/redo01.log
NO
****************************************************************
/home/sstephe2> ./ora_info.rb -c
control file path
/oracle/oradata/orcl/control01.ctl
/oracle/flash_recovery_area/orcl/control02.ctl
****************************************************************
/home/sstephe2> ./ora_info.rb -s
spfile path:
/oracle/product/11.2.0/dbs/spfileorcl.ora
****************************************************************
/home/sstephe2> ./ora_info.rb -p
pfile (init.ora) path:
/oracle/product/11.2.0/srvm/admin/init.ora
/oracle/product/11.2.0/dbs/init.ora
****************************************************************
/home/sstephe2> ./ora_info.rb -h
USAGE
[-t]: tablespace_names_and_path
[-r]: redlogfile_names_and_path
[-c]: controlfile_path
[-s]: spfile_path
[-p]: pfile_path
[-h]: usage
****************************************************************