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
hx509 CA functions(3)						Heimdalx509library					     hx509 CA functions(3)

NAME
hx509 CA functions - Functions int hx509_ca_tbs_init (hx509_context context, hx509_ca_tbs *tbs) void hx509_ca_tbs_free (hx509_ca_tbs *tbs) int hx509_ca_tbs_set_notBefore (hx509_context context, hx509_ca_tbs tbs, time_t t) int hx509_ca_tbs_set_notAfter (hx509_context context, hx509_ca_tbs tbs, time_t t) int hx509_ca_tbs_set_notAfter_lifetime (hx509_context context, hx509_ca_tbs tbs, time_t delta) struct units * hx509_ca_tbs_template_units (void) int hx509_ca_tbs_set_template (hx509_context context, hx509_ca_tbs tbs, int flags, hx509_cert cert) int hx509_ca_tbs_set_ca (hx509_context context, hx509_ca_tbs tbs, int pathLenConstraint) int hx509_ca_tbs_set_proxy (hx509_context context, hx509_ca_tbs tbs, int pathLenConstraint) int hx509_ca_tbs_set_domaincontroller (hx509_context context, hx509_ca_tbs tbs) int hx509_ca_tbs_set_spki (hx509_context context, hx509_ca_tbs tbs, const SubjectPublicKeyInfo *spki) int hx509_ca_tbs_set_serialnumber (hx509_context context, hx509_ca_tbs tbs, const heim_integer *serialNumber) int hx509_ca_tbs_add_eku (hx509_context context, hx509_ca_tbs tbs, const heim_oid *oid) int hx509_ca_tbs_add_crl_dp_uri (hx509_context context, hx509_ca_tbs tbs, const char *uri, hx509_name issuername) int hx509_ca_tbs_add_san_otherName (hx509_context context, hx509_ca_tbs tbs, const heim_oid *oid, const heim_octet_string *os) int hx509_ca_tbs_add_san_pkinit (hx509_context context, hx509_ca_tbs tbs, const char *principal) int hx509_ca_tbs_add_san_ms_upn (hx509_context context, hx509_ca_tbs tbs, const char *principal) int hx509_ca_tbs_add_san_jid (hx509_context context, hx509_ca_tbs tbs, const char *jid) int hx509_ca_tbs_add_san_hostname (hx509_context context, hx509_ca_tbs tbs, const char *dnsname) int hx509_ca_tbs_add_san_rfc822name (hx509_context context, hx509_ca_tbs tbs, const char *rfc822Name) int hx509_ca_tbs_set_subject (hx509_context context, hx509_ca_tbs tbs, hx509_name subject) int hx509_ca_tbs_set_unique (hx509_context context, hx509_ca_tbs tbs, const heim_bit_string *subjectUniqueID, const heim_bit_string *issuerUniqueID) int hx509_ca_tbs_subject_expand (hx509_context context, hx509_ca_tbs tbs, hx509_env env) int hx509_ca_sign (hx509_context context, hx509_ca_tbs tbs, hx509_cert signer, hx509_cert *certificate) int hx509_ca_sign_self (hx509_context context, hx509_ca_tbs tbs, hx509_private_key signer, hx509_cert *certificate) Detailed Description See the Hx509 CA functions for description and examples. Function Documentation int hx509_ca_sign (hx509_context context, hx509_ca_tbs tbs, hx509_cert signer, hx509_cert * certificate) Sign a to-be-signed certificate object with a issuer certificate. The caller needs to at least have called the following functions on the to-be-signed certificate object: o hx509_ca_tbs_init() o hx509_ca_tbs_set_subject() o hx509_ca_tbs_set_spki() When done the to-be-signed certificate object should be freed with hx509_ca_tbs_free(). When creating self-signed certificate use hx509_ca_sign_self() instead. Parameters: context A hx509 context. tbs object to be signed. signer the CA certificate object to sign with (need private key). certificate return cerificate, free with hx509_cert_free(). Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_sign_self (hx509_context context, hx509_ca_tbs tbs, hx509_private_key signer, hx509_cert * certificate) Work just like hx509_ca_sign() but signs it-self. Parameters: context A hx509 context. tbs object to be signed. signer private key to sign with. certificate return cerificate, free with hx509_cert_free(). Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_add_crl_dp_uri (hx509_context context, hx509_ca_tbs tbs, const char * uri, hx509_name issuername) Add CRL distribution point URI to the to-be-signed certificate object. Parameters: context A hx509 context. tbs object to be signed. uri uri to the CRL. issuername name of the issuer. Returns: An hx509 error code, see hx509_get_error_string(). issuername not supported int hx509_ca_tbs_add_eku (hx509_context context, hx509_ca_tbs tbs, const heim_oid * oid) An an extended key usage to the to-be-signed certificate object. Duplicates will detected and not added. Parameters: context A hx509 context. tbs object to be signed. oid extended key usage to add. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_add_san_hostname (hx509_context context, hx509_ca_tbs tbs, const char * dnsname) Add a Subject Alternative Name hostname to to-be-signed certificate object. A domain match starts with ., an exact match does not. Example of a an domain match: .domain.se matches the hostname host.domain.se. Parameters: context A hx509 context. tbs object to be signed. dnsname a hostame. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_add_san_jid (hx509_context context, hx509_ca_tbs tbs, const char * jid) Add a Jabber/XMPP jid Subject Alternative Name to the to-be-signed certificate object. The jid is an UTF8 string. Parameters: context A hx509 context. tbs object to be signed. jid string of an a jabber id in UTF8. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_add_san_ms_upn (hx509_context context, hx509_ca_tbs tbs, const char * principal) Add Microsoft UPN Subject Alternative Name to the to-be-signed certificate object. The principal string is a UTF8 string. Parameters: context A hx509 context. tbs object to be signed. principal Microsoft UPN string. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_add_san_otherName (hx509_context context, hx509_ca_tbs tbs, const heim_oid * oid, const heim_octet_string * os) Add Subject Alternative Name otherName to the to-be-signed certificate object. Parameters: context A hx509 context. tbs object to be signed. oid the oid of the OtherName. os data in the other name. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_add_san_pkinit (hx509_context context, hx509_ca_tbs tbs, const char * principal) Add Kerberos Subject Alternative Name to the to-be-signed certificate object. The principal string is a UTF8 string. Parameters: context A hx509 context. tbs object to be signed. principal Kerberos principal to add to the certificate. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_add_san_rfc822name (hx509_context context, hx509_ca_tbs tbs, const char * rfc822Name) Add a Subject Alternative Name rfc822 (email address) to to-be-signed certificate object. Parameters: context A hx509 context. tbs object to be signed. rfc822Name a string to a email address. Returns: An hx509 error code, see hx509_get_error_string(). void hx509_ca_tbs_free (hx509_ca_tbs * tbs) Free an To Be Signed object. Parameters: tbs object to free. int hx509_ca_tbs_init (hx509_context context, hx509_ca_tbs * tbs) Allocate an to-be-signed certificate object that will be converted into an certificate. Parameters: context A hx509 context. tbs returned to-be-signed certicate object, free with hx509_ca_tbs_free(). Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_ca (hx509_context context, hx509_ca_tbs tbs, int pathLenConstraint) Make the to-be-signed certificate object a CA certificate. If the pathLenConstraint is negative path length constraint is used. Parameters: context A hx509 context. tbs object to be signed. pathLenConstraint path length constraint, negative, no constraint. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_domaincontroller (hx509_context context, hx509_ca_tbs tbs) Make the to-be-signed certificate object a windows domain controller certificate. Parameters: context A hx509 context. tbs object to be signed. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_notAfter (hx509_context context, hx509_ca_tbs tbs, time_t t) Set the absolute time when the certificate is valid to. Parameters: context A hx509 context. tbs object to be signed. t time when the certificate will expire Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_notAfter_lifetime (hx509_context context, hx509_ca_tbs tbs, time_t delta) Set the relative time when the certificiate is going to expire. Parameters: context A hx509 context. tbs object to be signed. delta seconds to the certificate is going to expire. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_notBefore (hx509_context context, hx509_ca_tbs tbs, time_t t) Set the absolute time when the certificate is valid from. If not set the current time will be used. Parameters: context A hx509 context. tbs object to be signed. t time the certificated will start to be valid Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_proxy (hx509_context context, hx509_ca_tbs tbs, int pathLenConstraint) Make the to-be-signed certificate object a proxy certificate. If the pathLenConstraint is negative path length constraint is used. Parameters: context A hx509 context. tbs object to be signed. pathLenConstraint path length constraint, negative, no constraint. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_serialnumber (hx509_context context, hx509_ca_tbs tbs, const heim_integer * serialNumber) Set the serial number to use for to-be-signed certificate object. Parameters: context A hx509 context. tbs object to be signed. serialNumber serial number to use for the to-be-signed certificate object. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_spki (hx509_context context, hx509_ca_tbs tbs, const SubjectPublicKeyInfo * spki) Set the subject public key info (SPKI) in the to-be-signed certificate object. SPKI is the public key and key related parameters in the certificate. Parameters: context A hx509 context. tbs object to be signed. spki subject public key info to use for the to-be-signed certificate object. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_subject (hx509_context context, hx509_ca_tbs tbs, hx509_name subject) Set the subject name of a to-be-signed certificate object. Parameters: context A hx509 context. tbs object to be signed. subject the name to set a subject. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_template (hx509_context context, hx509_ca_tbs tbs, int flags, hx509_cert cert) Initialize the to-be-signed certificate object from a template certifiate. Parameters: context A hx509 context. tbs object to be signed. flags bit field selecting what to copy from the template certifiate. cert template certificate. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_set_unique (hx509_context context, hx509_ca_tbs tbs, const heim_bit_string * subjectUniqueID, const heim_bit_string * issuerUniqueID) Set the issuerUniqueID and subjectUniqueID These are only supposed to be used considered with version 2 certificates, replaced by the two extensions SubjectKeyIdentifier and IssuerKeyIdentifier. This function is to allow application using legacy protocol to issue them. Parameters: context A hx509 context. tbs object to be signed. issuerUniqueID to be set subjectUniqueID to be set Returns: An hx509 error code, see hx509_get_error_string(). int hx509_ca_tbs_subject_expand (hx509_context context, hx509_ca_tbs tbs, hx509_env env) Expand the the subject name in the to-be-signed certificate object using hx509_name_expand(). Parameters: context A hx509 context. tbs object to be signed. env enviroment variable to expand variables in the subject name, see hx509_env_init(). Returns: An hx509 error code, see hx509_get_error_string(). struct units* hx509_ca_tbs_template_units (void) [read] Make of template units, use to build flags argument to hx509_ca_tbs_set_template() with parse_units(). Returns: an units structure. Version 1.5.2 11 Jan 2012 hx509 CA functions(3)
All times are GMT -4. The time now is 11:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy