Sponsored Content
Full Discussion: UNIX script Validation
Top Forums Shell Programming and Scripting UNIX script Validation Post 302192609 by jim mcnamara on Wednesday 7th of May 2008 11:56:52 AM
Old 05-07-2008
Code:
. /usr/opt/oracle/cron/set_oraenv
. ${SCRIPT_DIR}/set_connect_params
export TOP_SCHEMA=${TOP_LOG}
export WHSE_SCHEMA=${VIW_LOG}
LOG_DIR=${SCRIPT_DIR}/logs
SCHED_DATE=`date "+%y%m%d"`
JOBSET_LOG=${LOG_DIR}/RUN_ROT_TOP_OCRS_MV_LOG_"$ENV"_$SCHED_DATE
export JOBSET_LOG
export LOG_DIR

echo "`date`: Refresh of ROT_TOP_OCRS_MV started" >> ${JOBSET_LOG}
#################################################################################
#
# Run the refresh of the ROT_TOP_OCRS_MV materialized view and then gather stats.
# Finally, insert an entry to COM_TABLE_LOAD_HIST to log the MV refresh.
#
#################################################################################

sqlplus -s ${TOP_LOG}/${TOP_PW}@${TOP_SID} <<END1>> ${JOBSET_LOG}

whenever sqlerror exit 2
whenever oserror exit 3
set heading off
set serveroutput on

select 'User ID: '||user||CHR(13)||CHR(10)||'Connected to: '||rtrim(global_name,'.US.ORACLE.COM.ATOSORIGIN') from dual,global_name;
select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS') from dual;

execute DBMS_OUTPUT.PUT_LINE('*** Now running the weekly ROT_TOP_OCRS_MV materialized view refresh ***');
execute DBMS_MVIEW.REFRESH('${TOP_SCHEMA}.ROT_TOP_OCRS_MV');

select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS') from dual;
execute DBMS_OUTPUT.PUT_LINE('*** Now gathering statistics ***');
exec DBMS_STATS.GATHER_TABLE_STATS(ownname => '${TOP_SCHEMA}',tabname => 'ROT_TOP_OCRS_MV',cascade => TRUE);

select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS') from dual;

exit
END1

if [ $? -ne 0 ] 
then
echo "`date`: Refresh of ROT_TOP_OCRS_MV failed" >> ${JOBSET_LOG}
status=3
else
echo "`date`: Refresh of ROT_TOP_OCRS_MV completed successfully" >> ${JOBSET_LOG}
fi

sqlplus -s ${VIW_LOG}/${VIW_PW} <<END1>> ${JOBSET_LOG}

whenever sqlerror exit 2
whenever oserror exit 3
set heading off
set serveroutput on

select 'User ID: '||user||CHR(13)||CHR(10)||'Connected to: '||rtrim(global_name,'.US.ORACLE.COM.ATOSORIGIN') from dual,global_name;
select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS') from dual;

execute DBMS_OUTPUT.PUT_LINE('*** Now inserting record stats to COM_TABLE_LOAD_HIST ***');
insert into COM_TABLE_LOAD_HIST 
select 'ROT_TOP_OCRS_MV',count(*),null,null,null,null,sysdate,'ROT_TOP_OCRS_MV last refreshed on '||to_char(sysdate,'DD-MON-RR') from ROT_TOP_OCRS_MV;
commit;

select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS') from dual;

exit
END1

if [[ $? -ne 0 || $status -eq 3 ]]
then
echo "`date`: Refresh of ROT_TOP_OCRS_MV failed" >> ${JOBSET_LOG}
exit 3
else
echo "`date`: Refresh of ROT_TOP_OCRS_MV completed successfully" >> ${JOBSET_LOG}
exit 0
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Time Validation in UNIX?

I am very new to scripting in UNIX and in need of help. I am creating a program that will check a file that has a target time in the form of HH:MM:SS before another program can begin executing. The file with the target time will only have that target time in it and nothing else. Is there any way... (1 Reply)
Discussion started by: mosammey
1 Replies

2. UNIX for Dummies Questions & Answers

How Can I Do Time Validation in UNIX

I am very new to scripting in UNIX and in need of help. I am creating a program that will check a file that has a target time in the form of HH:MM:SS before another program can begin executing. The file with the target time will only have that target time in it and nothing else. Is there any... (4 Replies)
Discussion started by: mosammey
4 Replies

3. UNIX for Dummies Questions & Answers

validation required in unix

is there any way to check null data against some of the column in file My file have such structure 1,,4,SUMISHO ,SMG110880 ,1,12,SUMISHO CAPITAL MANAGEMENT (SINGAPORE) PTE LTD ,ACCT01,20080531,2008,5,30,20080630,1,1,TXGRP ,CGST ,1,74,5.18,74,0,5.18... (2 Replies)
Discussion started by: u263066
2 Replies

4. UNIX for Dummies Questions & Answers

Unix File Validation! Help

Hi All, I got a file with 3 fields delimited by hyphen "-". I have to validate & cleanse the data before i begine the processing Requirements 1. No record should contain more than 2 delimiters 2. No record should even contain less than 2 delimiters 3. Any records that matches rule 1 &... (1 Reply)
Discussion started by: minnuverma
1 Replies

5. UNIX for Advanced & Expert Users

Unix File Validation! Help

Hi All, I got a file with 3 fields delimited by hyphen "-". I have to validate & cleanse the data before i begine the processing Requirements 1. No record should contain more than 2 delimiters 2. No record should even contain less than 2 delimiters 3. Any records that matches rule 1 &... (3 Replies)
Discussion started by: minnuverma
3 Replies

6. Shell Programming and Scripting

Unix File Validation! Help

Hi All, I got a file with 3 fields delimited by hyphen "-". I have to validate & cleanse the data before i begine the processing Requirements 1. No record should contain more than 2 delimiters 2. No record should even contain less than 2 delimiters 3. Any records that matches rule 1 &... (8 Replies)
Discussion started by: minnuverma
8 Replies

7. Shell Programming and Scripting

Date Validation in unix

I have a script which is take date as parameter sh abc.sh <2010-02-01> #!/sh/bin my_date=$1 #Here i want to two diffrent dates ## 3 Days before ##date14query=$mydate - 4 (it will be 2010-01-28) ##date24query=$mydate +4 (it will be 2010-01-05) #Please Help (3 Replies)
Discussion started by: pritish.sas
3 Replies

8. UNIX for Dummies Questions & Answers

Unix date validation

Dears, I am working on a batch that processes file with name containing date prefix eg., 20101222_file.dat. The logic is to process files in order. Eg., 20101225 must be processed only after 20101222. Ok first glance it looked simple, it use a variable to check this date value as number and... (2 Replies)
Discussion started by: naraink
2 Replies

9. Shell Programming and Scripting

Help With UNIX Shell Scripting For Data Validation

Hi All, I am completely new to Unix Shell Scripting. I m validating(Basic File Validation) an .HHT file in TIBCO. After that i need to do Data Validation through UNIX Shell scripting. Rules in DataValidation: 1.) Need to Check Every field wheather it is a Char or Number?(Fields are... (1 Reply)
Discussion started by: Chaitanya K
1 Replies

10. Shell Programming and Scripting

PAN card validation using UNIX

Please help me to validate PAN card using unix ---------- Post updated at 03:06 AM ---------- Previous update was at 02:21 AM ---------- 1) The first three letters are sequence of alphabets from AAA to zzz 2) The fourth character informs about the type of holder of the Card. Each assesse... (1 Reply)
Discussion started by: suryanarayana
1 Replies
DBIx::Class::Storage::DBI::Oracle::Generic(3)		User Contributed Perl Documentation	     DBIx::Class::Storage::DBI::Oracle::Generic(3)

NAME
DBIx::Class::Storage::DBI::Oracle::Generic - Oracle Support for DBIx::Class SYNOPSIS
# In your result (table) classes use base 'DBIx::Class::Core'; __PACKAGE__->add_columns({ id => { sequence => 'mysequence', auto_nextval => 1 } }); __PACKAGE__->set_primary_key('id'); # Somewhere in your Code # add some data to a table with a hierarchical relationship $schema->resultset('Person')->create ({ firstname => 'foo', lastname => 'bar', children => [ { firstname => 'child1', lastname => 'bar', children => [ { firstname => 'grandchild', lastname => 'bar', } ], }, { firstname => 'child2', lastname => 'bar', }, ], }); # select from the hierarchical relationship my $rs = $schema->resultset('Person')->search({}, { 'start_with' => { 'firstname' => 'foo', 'lastname' => 'bar' }, 'connect_by' => { 'parentid' => { '-prior' => { -ident => 'personid' } }, 'order_siblings_by' => { -asc => 'name' }, }; ); # this will select the whole tree starting from person "foo bar", creating # following query: # SELECT # me.persionid me.firstname, me.lastname, me.parentid # FROM # person me # START WITH # firstname = 'foo' and lastname = 'bar' # CONNECT BY # parentid = prior personid # ORDER SIBLINGS BY # firstname ASC DESCRIPTION
This class implements base Oracle support. The subclass DBIx::Class::Storage::DBI::Oracle::WhereJoins is for "(+)" joins in Oracle versions before 9.0. METHODS
get_autoinc_seq Returns the sequence name for an autoincrement column datetime_parser_type This sets the proper DateTime::Format module for use with DBIx::Class::InflateColumn::DateTime. connect_call_datetime_setup Used as: on_connect_call => 'datetime_setup' In connect_info to set the session nls date, and timestamp values for use with DBIx::Class::InflateColumn::DateTime and the necessary environment variables for DateTime::Format::Oracle, which is used by it. Maximum allowable precision is used, unless the environment variables have already been set. These are the defaults used: $ENV{NLS_DATE_FORMAT} ||= 'YYYY-MM-DD HH24:MI:SS'; $ENV{NLS_TIMESTAMP_FORMAT} ||= 'YYYY-MM-DD HH24:MI:SS.FF'; $ENV{NLS_TIMESTAMP_TZ_FORMAT} ||= 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'; To get more than second precision with DBIx::Class::InflateColumn::DateTime for your timestamps, use something like this: use Time::HiRes 'time'; my $ts = DateTime->from_epoch(epoch => time); relname_to_table_alias DBIx::Class uses DBIx::Class::Relationship names as table aliases in queries. Unfortunately, Oracle doesn't support identifiers over 30 chars in length, so the DBIx::Class::Relationship name is shortened and appended with half of an MD5 hash. See "relname_to_table_alias" in DBIx::Class::Storage. with_deferred_fk_checks Runs a coderef between: alter session set constraints = deferred ... alter session set constraints = immediate to defer foreign key checks. Constraints must be declared "DEFERRABLE" for this to work. ATTRIBUTES
Following additional attributes can be used in resultsets. connect_by or connect_by_nocycle Value: \%connect_by A hashref of conditions used to specify the relationship between parent rows and child rows of the hierarchy. connect_by => { parentid => 'prior personid' } # adds a connect by statement to the query: # SELECT # me.persionid me.firstname, me.lastname, me.parentid # FROM # person me # CONNECT BY # parentid = prior persionid connect_by_nocycle => { parentid => 'prior personid' } # adds a connect by statement to the query: # SELECT # me.persionid me.firstname, me.lastname, me.parentid # FROM # person me # CONNECT BY NOCYCLE # parentid = prior persionid start_with Value: \%condition A hashref of conditions which specify the root row(s) of the hierarchy. It uses the same syntax as "search" in DBIx::Class::ResultSet start_with => { firstname => 'Foo', lastname => 'Bar' } # SELECT # me.persionid me.firstname, me.lastname, me.parentid # FROM # person me # START WITH # firstname = 'foo' and lastname = 'bar' # CONNECT BY # parentid = prior persionid order_siblings_by Value: ($order_siblings_by | @order_siblings_by) Which column(s) to order the siblings by. It uses the same syntax as "order_by" in DBIx::Class::ResultSet 'order_siblings_by' => 'firstname ASC' # SELECT # me.persionid me.firstname, me.lastname, me.parentid # FROM # person me # CONNECT BY # parentid = prior persionid # ORDER SIBLINGS BY # firstname ASC AUTHOR
See "AUTHOR" in DBIx::Class and "CONTRIBUTORS" in DBIx::Class. LICENSE
You may distribute this code under the same terms as Perl itself. perl v5.18.2 2014-01-22 DBIx::Class::Storage::DBI::Oracle::Generic(3)
All times are GMT -4. The time now is 07:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy