The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
oracle connection from shell script DILEEP410 Shell Programming and Scripting 4 07-01-2009 03:19 AM
Command/script to find size of Unix Box ? sakthifire Shell Programming and Scripting 6 06-18-2008 03:07 AM
unix script to check whether particular file exists and to find its size Balachandar Shell Programming and Scripting 9 02-05-2008 03:56 AM
shell script to find files by date and size dadadc UNIX for Dummies Questions & Answers 1 10-20-2007 06:18 AM
Shell script to Find file size ragsnovel Shell Programming and Scripting 1 08-10-2007 11:01 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-24-2008
vighna vighna is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 1
Thumbs up Shell Script to find the tablespace size in oracle.

Hi,

I need to execute a script to find the tablespace size in oracle.But i get an error.

Script Executed:-

#!/bin/ksh
ORACLE_SID= oracelinstance
ORACLE_HOME= oracle path
PATH=$ORACLE_HOME/bin

export ORACLE_SID ORACLE_HOME PATH

sqlplus username/password@oracle_instance <<-EOF
set serveroutput on
whenever sqlerror exit 1;
spool /tmp/tab_tmp.log

connect sys/standard as sysdba;
select tablespace_name, round((sum(bytes)/1024/1024),2) size_in_mb,
sum(greatest(maxbytes,bytes))/1024/1024 total_available,
round(((sum(bytes)/1024/1024)/(sum(greatest(maxbytes,bytes))/1024/1024)),2) pct_used
from DBA_DATA_FILES group by tablespace_name order by 1;

spool off
EOF

exit 0

Error :

SQL>
SQL> connect sys/standard as sysdba;
Connected to an idle instance.
SQL>
SQL> select tablespace_name, round((sum(bytes)/1024/1024),2) size_in_mb,sum(greatest(maxbytes,bytes))/1024/1024 total_available,
round(((sum(bytes)/1024/1024)/(sum(greatest(maxbytes,bytes))/1024/1024)),2) pct_used
from DBA_DATA_FILES group by tablespace_name order by 1;


select tablespace_name, round((sum(bytes)/1024/1024),2) size_in_mb,
sum(greatest(maxbytes,bytes))/1024/1024 total_available,
round(((sum(bytes)/1024/1024)/(sum(greatest(maxbytes,bytes))/1024/1024)),2) pct_used
from DBA_DATA_FILES group by tablespace_name order by 1

*
ERROR at line 1:
ORA-01034: ORACLE not available
  #2 (permalink)  
Old 07-24-2008
melanie_pfefer melanie_pfefer is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 234
this simply means that the oracle instance is down.

sql> startup immediate;

and then run your script again
  #3 (permalink)  
Old 07-24-2008
vitchi vitchi is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 19
Hi,

first you have to check if all instances od oracle are running:

oracle> ps -ef |grep pmon --> you should see all oracle instances on output
  #4 (permalink)  
Old 07-24-2008
vitchi vitchi is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 19
and try also to check the connection to your database:

sql> select from sysdate from dual; -->you should get system date and hour
  #5 (permalink)  
Old 07-26-2008
caoshutao caoshutao is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 1
maybe the world oracle in your "ORACLE_SID= oracelinstance " mistake by oracel
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:38 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0