Sponsored Content
Full Discussion: Removal of space
Top Forums Shell Programming and Scripting Removal of space Post 303011058 by Praful Pednekar on Friday 12th of January 2018 01:04:28 PM
Old 01-12-2018
Code:
cd /u01/script/latest/
rm -rf check_tablespace.temp datafiles.log sql.log tbs.sql tbs.temp
sqlplus -s / as sysdba  << eof > /u01/script/latest/check_tablespace.temp
set pages 0
Select a.tablespace_name,sum(a.tots/1048576) Tot_Size,
sum(a.sumb/1024) Tot_Free, sum(a.sumb)*100/sum(a.tots) Pct_Free,
ceil((((sum(a.tots) * 15) - (sum(a.sumb)*100))/85 )/1048576) Min_Add
from (select tablespace_name,0 tots,sum(bytes) sumb
from dba_free_space a
group by tablespace_name
union
Select tablespace_name,sum(bytes) tots,0 from
dba_data_files
group by tablespace_name) a
group by a.tablespace_name
having sum(a.sumb)*100/sum(a.tots) < 10
order by pct_free;
exit
eof
cd /u01/script/latest/

chmod ugo+rw /u01/script/latest/check_tablespace.temp
counter=`cat check_tablespace.temp | sed '/^$/d'| wc -l`
echo "count="$counter
#imaintbs=`awk '{print $1}' check_tablespace.temp`
maintbs=$(cat /u01/script/latest/check_tablespace.temp | cut -d' ' -f1 | sed '/^\s*$/d' >>/u01/script/latest/tbs.temp)
#echo $maintbs  >> /u01/script/latest/tbs.temp
echo $maintbs

echo "THESE ARE THE SQL FILES PRESENT IN THE GIVEN PATCH:"
var1=$1
echo "Do You Want To APPLY Sql FILE????"
RESPONSE1=1

while :
do
read RESPONSE

if [ "$RESPONSE" == "YES" -o "$RESPONSE" == "yes" ]
then

file=/u01/script/latest/tbs.temp
while IFS= read -r LINE; do
#echo  "select file_name from dba_data_files where tablespace_name='$LINE';" >> /u01/script/latest/tbs.sql
echo "select file_name from dba_data_files where tablespace_name = ${LINE%%};"  >> /u01/script/latest/tbs.sql
 done < "$file"

sqlplus -s / as sysdba  << eof > /u01/script/latest/datafiles.log
@/u01/script/latest/tbs.sql
eof
exit

rm -rf /u01/script/latest/tbs.temp
rm -rf /u01/script/latest/tbs.sql
exit
                RESPONSE=$?
echo "SQL DEPLOYMENT COMPLETED"

elif [ "$RESPONSE" == "NO" -o "$RESPONSE" == "no" ]
then
echo "sql not applied"
exit
        RESPONSE1=$?
else
        echo "Please Enter correct choice"
fi
        if [ $RESPONSE1 -eq 0 ]
        then
        break
fi
done


Last edited by MadeInGermany; 01-12-2018 at 04:16 PM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removal

I am using Unix as my OS on my server and would like to format my hard drive. How do I go about wiping my hard drive or is there a removal tool that I can use? (1 Reply)
Discussion started by: anaconda
1 Replies

2. UNIX for Dummies Questions & Answers

Removal of Data

Hi All, (And first up, a Happy New Year to you all! 363 days to go!) I need to make sure that our old Sun Sparcstations and Servers are clear of any Confidential data before I return them... Suggestions? I'm formatting the discs to make sure that there's nothing obvious, but would... (5 Replies)
Discussion started by: geralex
5 Replies

3. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

4. Homework & Coursework Questions

removal of files?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: remove all files and only files that the first three characters start with numerals. 2. Relevant commands,... (6 Replies)
Discussion started by: linuxtraining
6 Replies

5. UNIX for Dummies Questions & Answers

semaphore removal

I have one process which creates semaphore with permission 600. Then at some part of the code I have line where this semaphore will be removed. Problem I have is that other processes in my program also try to execute this line of code. Of course since they dont have permission they wont be able to... (1 Reply)
Discussion started by: joker40
1 Replies

6. Shell Programming and Scripting

\n removal between two |

I have a multi-line string I'm trying to do some clean-up on. Example: 1|575|67866|"fgnhdgj"|"afhgajh agfajgf ahfjhgfk ahfkhf"|568 2|56|5435|"mayank"|"gupta gdja agdjagf"|677 3|5666|5435|"mayank"|"gupta gdja agdjagf"|677 I need a shell script that replace all \n under " ". (11 Replies)
Discussion started by: mayankgupta18
11 Replies

7. UNIX for Dummies Questions & Answers

removal of space from the end

HI, I need the help from the experts like I have created one file with text like: Code: a b c de f g hi j k l So my question is that i have to write the script in which like in the first sentence it will take only one space after d and remove all the extra space in the end.I dont... (0 Replies)
Discussion started by: bhanudhingra
0 Replies

8. Shell Programming and Scripting

Undesired removal of white space with awk

Hi, I'm fairly new to scripting and I have a problem that I am having difficulty solving. What I'd like to do is run an awk script to adjust the string in the first field depending on the string in another field. This is best explained with an example: Here is my script: cat... (4 Replies)
Discussion started by: calbrex
4 Replies

9. UNIX for Advanced & Expert Users

Duplicate removal

I have an input file of 5GB which contains duplicate records and have to remove duplicate records by retaing first instance of that record . Based on 5 fields the duplicates has to be removed . Kindly request to help me in writing a Unix Script. Thanks Asim (11 Replies)
Discussion started by: duplicate
11 Replies

10. Web Development

Vbseo removal

first off i want to thank you for such a great site, you helped me narrow down a long search on what was wrong with my forum, i have a large forum motorbicycling DOT com which i had someone remove vbseo before they went under because of all the security problems. anyway i have lots of 404 errors... (13 Replies)
Discussion started by: atcspaul
13 Replies
INNOCHECKSUM(1) 					       MySQL Database System						   INNOCHECKSUM(1)

NAME
innochecksum - offline InnoDB file checksum utility SYNOPSIS
innochecksum [options] file_name DESCRIPTION
innochecksum prints checksums for InnoDB files. This tool reads an InnoDB tablespace file, calculates the checksum for each page, compares the calculated checksum to the stored checksum, and reports mismatches, which indicate damaged pages. It was originally developed to speed up verifying the integrity of tablespace files after power outages but can also be used after file copies. Because checksum mismatches will cause InnoDB to deliberately shut down a running server, it can be preferable to use this tool rather than waiting for a server in production usage to encounter the damaged pages. innochecksum cannot be used on tablespace files that the server already has open. For such files, you should use CHECK TABLE to check tables within the tablespace. If checksum mismatches are found, you would normally restore the tablespace from backup or start the server and attempt to use mysqldump to make a backup of the tables within the tablespace. Invoke innochecksum like this: shell> innochecksum [options] file_name innochecksum supports the following options. For options that refer to page numbers, the numbers are zero-based. o -c Print a count of the number of pages in the file. o -d Debug mode; prints checksums for each page. o -e num End at this page number. o -p num Check only this page number. o -s num Start at this page number. o -v Verbose mode; print a progress indicator every five seconds. COPYRIGHT
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. AUTHOR
Sun Microsystems, Inc. (http://www.mysql.com/). MySQL 5.1 04/06/2010 INNOCHECKSUM(1)
All times are GMT -4. The time now is 07:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy