Sponsored Content
Top Forums Shell Programming and Scripting Shell Script to find the tablespace size in oracle. Post 302217980 by vighna on Thursday 24th of July 2008 02:37:08 AM
Old 07-24-2008
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.Smilie

Script Executed:-

Code:
#!/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 

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to Find file size

Hi, I am writing a script which takes the input file name and concat as a new file by appending a "1" to the file name. However i am not able to get the size of this new file. I am not sure where i am going wrong. Please check the script and help me get this working. #!/bin/sh ... (1 Reply)
Discussion started by: ragsnovel
1 Replies

2. UNIX for Dummies Questions & Answers

shell script to find files by date and size

Hi, I have a directory PRIVATE in which I have several directories and each of these have several files. Therefore, I need to find those files by size and date to back up those files in another directory. I don't know how to implement this shell script using ''find''. appreciate any... (1 Reply)
Discussion started by: dadadc
1 Replies

3. Shell Programming and Scripting

find process size script

Hello i am working on a project here is part of script that i need a help in get process SpectroSERVER current size if it exceed 3850 MB then #pkill -TERM ArchMgr and wait to succfull shutdown message from the log file to proceed to the next step #tail -f $SPECROOT/SS/DDM/ARCHMGR.OUT... (7 Replies)
Discussion started by: mogabr
7 Replies

4. Shell Programming and Scripting

Need help in a shell script to edit a tablespace creation script.

Hi, CREATE TABLESPACE aps_blob_large01 DATAFILE '/c2r6u13/u03/oradata/qnoldv01/aps_blob_large0101.dbf' SIZE X 270532608 REUSE DEFAULT STORAGE (INITIAL 134217728 NEXT... (2 Replies)
Discussion started by: rparavastu
2 Replies

5. Shell Programming and Scripting

error in script path for tablespace usage

Hi , I am trying to run this script in crontab but I get errors. When I run it explicitly like ./monitor_tblsp from another location then it runs fine . I am messing somewhere with paths but I don't know where and how . Please help . Here is the error part ./monitor_tblsp: touch: not... (2 Replies)
Discussion started by: capri_drm
2 Replies

6. Shell Programming and Scripting

alias to a shell script - tablespace size

I have developed the following shell script. The idea was to create an alias to execute it and return the tablespaces and their sizes from an oracle database. When I execute is via the alias, I have issues. So, here is the script first: > cat ts_size.sh #!/bin/ksh xwhere=" " xwild=" "... (8 Replies)
Discussion started by: desibabu
8 Replies

7. Shell Programming and Scripting

tablespace monitoring script

I have prepared the below script to monitor the tablespace and alert the users whenever it reaches a threshold limit. #!/bin/sh . /home/.profile sqlplus -s $LOGON << .eof > $scripts/check_tablespace.temp set pages 0 select tablespace_name, free_percent from ( SELECT... (4 Replies)
Discussion started by: svajhala
4 Replies

8. Shell Programming and Scripting

Script to check Oracle tablespace

I'm new to unix script, and I need to check the tablespaces daily, here is the script(quite simple), but it does not work. Did I missed something ? Please guide me, Many thanks ! #!/bin/sh echo "ORA TABLEASPACE:" sqlplus system/oracle as sysdba; set pagesize 9999; set linesize 132; ... (5 Replies)
Discussion started by: dehetoxic
5 Replies

9. Shell Programming and Scripting

Error in Scripting to monitor tablespace in Oracle DB

Buddies, I am writing the below script 'tab.sh' to monitor the tablespaces in Database:- ------------------------------- export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2 export PATH=$PATH:$ORACLE_HOME/bin export ORACLE_SID=orcl sqlplus system/oracle as sysdba <<EOF spool... (5 Replies)
Discussion started by: sandip250382
5 Replies

10. Shell Programming and Scripting

Shell script to find size of subdirectories

Hi I have to find size of subdirectory and automate it in CRON. Eg: parent directory name is NVBKP inside it there are several subdirectories I want to get the size of recent two subdirectories. I have tried ls -ltr diretory path | tail -2 But it is providing only size of the folder not... (8 Replies)
Discussion started by: ankit2012
8 Replies
DROP 
TABLESPACE(7) PostgreSQL 9.2.7 Documentation DROP TABLESPACE(7) NAME
DROP_TABLESPACE - remove a tablespace SYNOPSIS
DROP TABLESPACE [ IF EXISTS ] name DESCRIPTION
DROP TABLESPACE removes a tablespace from the system. A tablespace can only be dropped by its owner or a superuser. The tablespace must be empty of all database objects before it can be dropped. It is possible that objects in other databases might still reside in the tablespace even if no objects in the current database are using the tablespace. Also, if the tablespace is listed in the temp_tablespaces setting of any active session, the DROP might fail due to temporary files residing in the tablespace. PARAMETERS
IF EXISTS Do not throw an error if the tablespace does not exist. A notice is issued in this case. name The name of a tablespace. NOTES
DROP TABLESPACE cannot be executed inside a transaction block. EXAMPLES
To remove tablespace mystuff from the system: DROP TABLESPACE mystuff; COMPATIBILITY
DROP TABLESPACE is a PostgreSQL extension. SEE ALSO
CREATE TABLESPACE (CREATE_TABLESPACE(7)), ALTER TABLESPACE (ALTER_TABLESPACE(7)) PostgreSQL 9.2.7 2014-02-17 DROP TABLESPACE(7)
All times are GMT -4. The time now is 10:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy