473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

diff


diff -u /home/system/db2inst1/nya/bin/db2filter.py ./db2filter.py
--- /home/system/db2inst1/nya/bin/db2filter.py 2007-01-12
15:23:34.000000000 +0100
+++ ./db2filter.py 2007-04-14 02:31:58.000000000 +0200
@@ -26,24 +26,31 @@

def main():
ignore = [ "DB20000I" ]
+ single = False
try:
- opts, args = getopt.getopt(sys.argv[1:], "i:")
+ opts, args = getopt.getopt(sys.argv[1:], "i:s")
except getopt.GetoptError:
sys.exit(-1)
for o, a in opts:
if (o == "-i"):
args = a.split(',')
ignore += args
+ if (o == "-s"):
+ single = True

inf = sys.stdin
lines = ''
+ lastline = ''
for line in inf:
+ lastline = line
m = re.match('^\S*$', line)
if (m == None):
lines += line
else:
parse_line(lines, ignore)
lines = ''
+ if (single):
+ parse_line(lastline, ignore)

if __name__ == "__main__":
main()
diff -u /home/system/db2inst1/nya/bin/pre_upgrade.py ./pre_upgrade.py
--- /home/system/db2inst1/nya/bin/pre_upgrade.py 2007-01-12
15:23:34.000000000 +0100
+++ ./pre_upgrade.py 2007-04-14 07:30:54.000000000 +0200
@@ -136,7 +136,8 @@
print line

if (current_state < 2):
- print """values 'Upgrade aborted. Database version already >=
%s' @
+ print """
+ values 'Upgrade aborted. Database version already >= %s' @
-- generate error, exit(4)
drop index sysibm.XXX @
""" % (cv)
diff -u /home/system/db2inst1/nya/bin/upgrade.sh ./upgrade.sh
--- /home/system/db2inst1/nya/bin/upgrade.sh 2007-03-12
12:08:08.000000000 +0100
+++ ./upgrade.sh 2007-04-14 10:07:54.000000000 +0200
@@ -1,7 +1,6 @@
#!/bin/sh

-# source helpers
-. db_helpers
+declare -i rc

#############################################
# Parse cmdline
@@ -50,7 +49,7 @@
mkdir -p ${logdir}
db=`echo ${DB} | tr a-z A-Z`
date=`date "+%Y-%m-%d_%H:%M:%S"`
-logfile=${logdir}/${db}_${date}.log
+logfile=${logdir}${db}_${date}.log

export PATH=${bindir}:${PATH}

@@ -74,7 +73,7 @@
* upgrade $db aborted `date +%Y%m%d%H%M%S`
************************************************** **
EOF
- db2 terminate
+ db2 terminate /dev/null 2>&1;
exit 1
}

@@ -86,7 +85,7 @@
* upgrade $db finished `date +%Y%m%d%H%M%S`
************************************************** **
EOF
- db2 terminate
+ db2 terminate /dev/null 2>&1;
exit 0
}

@@ -105,6 +104,55 @@
abort "ERROR: wrong usage";
}

+runstats_and_rebind() {
+
+ cnt=0
+ echo "---------------------------------------------" | tee -a
${logfile}
+ echo "Doing runstats for tables with old statistics" | tee -a
${logfile}
+ echo "---------------------------------------------" | tee -a
${logfile}
+
+ for t in `db2 -x "select rtrim(tabschema) || '.' || tabname \
+ from syscat.indexes i \
+ where tabschema in ('NYA','STUDERA','HUBBLE','URVAL') \
+ and exists ( \
+ select 1 from syscat.tables t \
+ where (i.tabschema, i.tabname) = (t.tabschema, t.tabname) \
+ and t.type in ('S','T') \
+ ) \
+ and (stats_time + 24 hours < current timestamp or \
+ nleaf = -1 or nlevels = -1)"`; do
+ db2 -s -l ${logfile} "runstats on table $t and indexes
all" | ./db2filter.py -s 2>&1
+ cnt=`expr $cnt + 1`
+ done
+ echo ""
+ echo ""
+ echo "Updated statistics for $cnt tables" | tee -a ${logfile}
+ echo ""
+
+ cnt=0
+ echo "-------------------------------------" | tee -a ${logfile}
+ echo "Rebinding invalid procedures/packages" | tee -a ${logfile}
+ echo "-------------------------------------" | tee -a ${logfile}
+
+ for p in `db2 -x "select \
+ rtrim(z.ROUTINESCHEMA) || '.' ||
rtrim(z.ROUTINENAME) \
+ from syscat.packages y \
+ inner join syscat.routinedep x \
+ on (x.BSCHEMA, x.BNAME) = (y.PKGSCHEMA, y.PKGNAME) \
+ inner join syscat.routines z \
+ on (x.ROUTINESCHEMA, x.ROUTINENAME) =
(z.ROUTINESCHEMA, z.SPECIFICNAME) \
+ where y.valid <'Y' \
+ or z.valid <'Y'"`; do
+ db2 -s -l ${logfile} "call
sysproc.rebind_routine_package('P','$p','ANY')" | ./db2filter.py -i
"Return Status = 0" 2>&1
+ cnt=`expr $cnt + 1`
+ done
+ echo ""
+ echo ""
+ echo "Rebinded $cnt procedures/packages" | tee -a ${logfile}
+ echo ""
+}
+
+
#############################################
# Validation of input
#############################################
@@ -116,6 +164,10 @@
[ "x${username}" = "x" ] && usage
[ "x${passwd}" = "x" ] && usage

+echo "-----------------" | tee -a ${logfile}
+echo "Preparing upgrade" | tee -a ${logfile}
+echo "-----------------" | tee -a ${logfile}
+
db=`echo ${DB} | tr a-z A-Z`
if [ "x${username}" = "x" ]; then
db2 connect to ${db} /dev/null 2>&1;
@@ -127,6 +179,7 @@
abort "ERROR: Unable to connect to ${db}"
fi

+
# create function to cmp versions
pushd ${basedir}/function/ /dev/null 2>&1;
dos2unix GET_DB_VERSION.sql /dev/null 2>&1;
@@ -165,25 +218,40 @@
pushd /tmp /dev/null 2>&1
dos2unix current_upgrade.sql /dev/null 2>&1;
popd /dev/null 2>&1
-db2 -s +c -l ${logfile} -td@ -f /tmp/current_upgrade.sql
-rc=$?

-echo ""
-echo "-----------------------------------------------------"
+echo "" | tee -a ${logfile}
+echo "-----------------" | tee -a ${logfile}
+echo "Executing upgrade" | tee -a ${logfile}
+echo "-----------------" | tee -a ${logfile}
+
+db2 -x -s +c -l ${logfile} -td@ -f /tmp/current_upgrade.sql |
../db2filter.py -i "Return Status = 0"
+rc=${PIPESTATUS[0]}
+
+echo "" | tee -a ${logfile}

if [ $rc -ge 4 ]; then
- echo "ERROR: Transactions where rolled back due to error"
- echo " db2 exit with $rc, see ${logfile} for details"
- db2 rollback /dev/null 2>&1;
+ echo "-----------------------------------------------------" | tee
-a ${logfile}
+ echo "ERROR: Transactions where rolled back due to error" | tee
-a ${logfile}
+ echo " db2 exit with $rc, see ${logfile} for details" | tee
-a ${logfile}
+ echo "-----------------------------------------------------" | tee
-a ${logfile}
+ db2 rollback /dev/null 2>&1;
+ abort
elif [ $rc -gt 0 ]; then
- echo "INFO: There where warnings but all transactions where
committed succesfully."
- echo " db2 exit with $rc, see ${logfile} for details"
db2 commit /dev/null 2>&1;
+ runstats_and_rebind
+ echo "-----------------------------------------------------" | tee
-a ${logfile}
+ echo "INFO: There where warnings but all transactions where
committed succesfully." | tee -a ${logfile}
+ echo " db2 exit with $rc, see ${logfile} for details" | tee
-a ${logfile}
+ echo "-----------------------------------------------------" | tee
-a ${logfile}
+ success
else
- echo "INFO: All transactions where committed succesfully."
db2 commit /dev/null 2>&1;
+ runstats_and_rebind
+ echo "-----------------------------------------------------" | tee
-a ${logfile}
+ echo "INFO: All transactions where committed succesfully." | tee
-a ${logfile}
+ echo "-----------------------------------------------------" | tee
-a ${logfile}
+ success
fi

-db2 connect reset /dev/null 2>&1;
+#db2 connect reset /dev/null 2>&1;

-echo "-----------------------------------------------------"

Apr 14 '07 #1
1 1977
On Apr 14, 11:26 am, Lennart <erik.lennart.jons...@gmail.comwrote:

Sorry, completely wrong address

/Lennart

[...]

Apr 14 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Charley | last post by:
I've got a diff file that I think is a patch for a bunch of file in a directory. How do I apply this file? I thought it was #patch myfile.diff But that does nothing. I must be missing...
0
by: python | last post by:
Hi- I have a lot of monthly time series data. I need to be able to compare two dates and get the number of months that they are apart. The datetime module is a daily-frequency data type. ...
3
by: Nick Allen | last post by:
After using ndiff from difflib, the function restore would return the sequence that generated the delta. Unfortunately, restore does not do the same for unified_diff. I do not see any similar...
9
by: Ching-Lung | last post by:
Hi all, I try to create a tool to check the delta (diff) of 2 binaries and create the delta binary. I use binary formatter (serialization) to create the delta binary. It works fine but the...
6
by: Igor Shevchenko | last post by:
Hi! Suppose I have "pg_dump -s" of two pg installs, one is "dev", another is "production". Their schemas don't differ too much, and I want to get a "diff -u"-like schema diff so I can quickly...
4
by: Andreas Kasparek | last post by:
Hola! I'm preparing my master thesis about a XML Merge Tool implementation and was wondering if there is any open standard for XML diff regarding topics like: - is a diff result computed on...
3
by: AirYT | last post by:
Hello, I'm looking for an implementation for diffing 2 (text) files and spitting out the output using php only. i would like to extend this to use ftp to diff two files on two ftp servers, or...
4
by: Shug | last post by:
Hi, We're reformatting a lot of our project code using the excellent uncrustify beautifier. However, to gain confidence that it really is only changing whitespace (forget { } issues for just...
6
by: Aaron Gray | last post by:
Hi, I am working on an HTML WYSISYG Wiki and need to display a diff page like WikiPedia does if two people edit a file at the same time to give the second user the diff. Basically with additions...
2
by: akshaycjoshi | last post by:
I have got one tree tree view control.I have three levels in it. Example- Root1 ------->child1 ------->child2 ---------------->child1 ---------------->child2 ------->child3 Root2
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.