mattypenny

Sqlserver Management Studio

I spent a couple of lunchtimes going through Sqlserver Management Studio’s ‘Object Explorer’ panel, typing up all the different elements. This might seem like an odd thing to do, but I thought it might be useful for the following reasons:

  • as a reference. A searchable list of where everything is
  • as the beginnings of a checklist. Making a system wide change it might be handy to scan through this list and consider whether there’s an impact on each element
  • to get me blogging again :)

Databases
  System Databases
  Database Snapshots
  User Databases
    Database Diagrams
    Tables
    Views
    Synonyms
    Programmability
      Stored Procedures
      Functions
      Triggers
      Assemblies
      Types
      Rules
      Defaults
      Plan Guides
    Service Broker
      Message Types
      Contracts
      Queues
      Services
      Routes
      Remote ServiceBindings
      Broker Priorities
    Storage
      Full Text Catalogs
      Partition Schenes
      Patition Functions
      Full Text Stoplists
    Security
      Users
      Roles
      Schemas
      Asymmetric Keys
      Certificates
      Symmetric Keys
      Database Audit Specifications
Security
  Logins
  Server Roles
  Credentials
  Cryptographic Providers
  Audits
  Server Audit Specifications
Server Objects
  Backup Devices
  Endpoints
    System Endpoints
      Database Mirroring
      Service Broker
      SOAP
      TSQL
        Dedicated Admin Connection
        TSQL Default TCP
        TSQL Default VIA
        TSQL Local Machine
        TSQL Named Pipes
    Database Mirroring
    Service Broker
    SOAP
    TSQL
  Linked Servers
    Providers
  Triggers
Replication
  Local publications
  Local subscriptions
Management
  Data-tier Applications
  Policy Management
    Policies
      System Policies
    Conditions
      System Conditions
    Facets
  Data Collection
  Resource Governor
    Resource Pools
      System Resource Pools
  Maintenance Plans
SQL Server Logs
  Database Mail
  Distributed Trnasaction Co-ordinator
Legacy
  Database Maintenance Plans
  Data Transformation Services
  SQL Mail
SQL Server Agent
  Jobs
  Alerts
  Operators
  Proxies
  Error Logs

Nid(dbnewid) hangs

I had to run nid (also known as dbnewid) on a database as part of a test refresh at the weekend. This changes the dbid of the database.

Out of sheer laziness I ran it from with sqlplus by using the ‘!’ host command feature.

Nid, quite understandablly doesn’t really like this - it hangs.

I ctrl-c’d it, exited to the OS and re-ran and it worked fine.

The 10g doc for nid is here: http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dbnewid.htm

Mucking about with analytic functions

I’ve never really used the analytic functions in anger, so consequently I don’t really have the skills at my fingertips. By way of re-learning them (using Expert One-on-One Oracle | Thomas Kyte | Apress) I’ve been playing about with a list of English Premiership scorers.

The table is:

SQL> desc goals
Name                                      Null?    Type
----------------------------------------- -------- ------------

DIVISION                                  NOT NULL VARCHAR2(20)
END_DATE                                  NOT NULL DATE
PLAYER                                    NOT NULL VARCHAR2(40)
TEAM                                               VARCHAR2(20)
GOALS                                              NUMBER 

The third highest scorer for each team, should you want to know that bit of information, is given by:

select * 
from (select team, player, goals, 
row_number() over (partition by team order by goals desc) ranking
from goals)
where ranking = 3

Output is:

TEAM             PLAYER                GOALS RANKING
---------------- --------------------- ----- -------
Arsenal          Robin van Persie          7       3
Aston Villa      Ashley Young              5       3
Birmingham       Sebastian Larsson         4       3
Blackburn        Morten Gamst Pedersen     3       3
Bolton           Kevin Davies              5       3
Burnley          David Nugent              6       3
Chelsea          Florent Malouda          11       3
Everton          Mikel Arteta              5       3
Fulham           Damien Duff               6       3
Hull City        Deiberson Geovanni        3       3
Liverpool        Steven Gerrard            7       3
Man Utd          Antonio Valencia          5       3
Manchester City  Craig Bellamy             9       3
Portsmouth       Nadir Belhadj             3       3
Stoke City       Ricardo Fuller            3       3
Sunderland       Fraizer Campbell          4       3
Tottenham        Niko Kranjcar             6       3
West Ham Utd     Guillermo Franco          4       3
Wigan Athletic   Paul Scharner             4       3
Wolves           Matthew Jarvis            3       3

To further develop this query to return a pivot table, you use a decode on the artificial ‘ranking’ field, as follows:

select team,
max(decode(ranking, 1, player, null)) golden_boot,
max(decode(ranking, 2, player, null)) silver_boot,
max(decode(ranking, 3, player, null)) bronze_boot
from
(select team, player, goals, row_number()
over (partition by team order by goals desc) ranking
from goals)
where ranking <= 3 group by team 

This returns:

SQL> /

TEAM             GOLDEN_BOOT         SILVER_BOOT         BRONZE_BOOT
---------------- ------------------- ------------------- -------------------
Arsenal          Francesc Fabregas   Andrey Arshavin     Robin van Persie
Aston Villa      Gabriel Agbonlahor  John Carew          Ashley Young
Birmingham       Cameron Jerome      Lee Bowyer          Sebastian Larsson
Blackburn        David Dunn          Jason Roberts       Morten Gamst Peders
Bolton           Matthew Taylor      Ivan Klasnic        Kevin Davies
Burnley          Steven Fletcher     Graham Alexander    David Nugent
Chelsea          Didier Drogba       Frank Lampard       Florent Malouda
Everton          Louis Saha          Tim Cahill          Mikel Arteta
Fulham           Bobby Zamora        Clinton Dempsey     Damien Duff
Hull City        Stephen Hunt        Jimmy Bullard       Deiberson Geovanni
Liverpool        Fernando Torres     Dirk Kuyt           Steven Gerrard
Man Utd          Wayne Rooney        Dimitar Berbatov    Antonio Valencia
Manchester City  Carlos Tevez        Emmanuel Adebayor   Craig Bellamy
Portsmouth       Aruna Dindane       Frederic Piquionne  Nadir Belhadj
Stoke City       Matthew Etherington Tuncay Sanli        Ricardo Fuller
Sunderland       Darren Bent         Kenwyne Jones       Fraizer Campbell
Tottenham        Jermain Defoe       Peter Crouch        Niko Kranjcar
West Ham Utd     Carlton Cole        Alessandro Diamanti Guillermo Franco
Wigan Athletic   Hugo Rodallega      Charles N'Zogbia    Paul Scharner
Wolves           Kevin Doyle         Jody Craddock       Matthew Jarvis

20 rows selected.  

ORA-01552: cannot use system rollback segment.....

Another post that’s unlikely to be all that useful….but you never know.

As per a couple of my previous posts, I’m re-doing my Oracle certification from the ground up instead of doing the 10G new features only.

I’m using Oracle Database 10g OCP Certification by Damir Bersinic and John Watson, which from the bits I’ve read so far, I would recommend.

Anyhow, the book says:

If you are using UNDO_MANAGEMENT=AUTO, you must also specify UNDO_TABLESPACE.

I was curious to see how this was enforced, in particular whether you would get an error if you tried to ALTER SYSTEM to nullify the undo tablespace parameter. You don’t - you get an error when you try to use the undo, as follows:

SQL> @sparam
Enter value for parameter_name: UNDO
old   5: where name like lower('%&parameter_name%')
new   5: where name like lower('%UNDO%')
undo_management                AUTO                                          F
undo_retention                 900                                           T
undo_tablespace                UNDOTBS1                                      F

SQL> alter system set undo_tablespace='' scope =both;

System altered.

SQL> delete from scott.emp;
delete from scott.emp
                  *
ERROR at line 1:
ORA-01552: cannot use system rollback segment for non-system tablespace 'USERS'

Convert an html table to excel spreadsheet

A quick and dirty post for a quick and dirty technique that I used to get the Oracle CPU Database Risk Matrix into a spreadsheet. This won’t always work (the html table I was interested in happened to have the data in the same line of html as the tag), but it’s a start.

  • Do ‘View Source’ to get the html for the table.
  • Find the table
  • Cut and paste the table into a text file. I called mine “risk_matrix_raw.txt”
  • Create an awk file (mine was called risk_matrix.awk) with the following lines:
/<tr>/{printf("\n")}
/<td/{printf("%s~", $2)}
  • awk the text file, then pipe into sed to remove some of the tags
awk95 -F">" -f risk_matrix.awk risk_matrix_raw.txt |^ sed -e "s/<\/tr//g" -e "s/<\/td//g" \> risk_matrix.txt
  • Open the .txt file in Excel. When I did this, Excel asks whether its a fixed width or a delimited file. I specified that the file was delimited with a ‘~’ and Excel opened it.

Note (April 2020): for some reason in the original version of this post I had the code in .jpg files. Mea culpa. I’ve typed the code in, but not been able to test as yet, so, just for reference here are the original .jpgs

Awk commands Sed command

Convert an html table to excel spreadsheet

A quick and dirty post for a quick and dirty technique that I used to get the Oracle CPU Database Risk Matrix into a spreadsheet. This won’t always work (the html table I was interested in happened to have the data in the same line of html as the tag), but it’s a start.

  • Do ‘View Source’ to get the html for the table.
  • Find the table
  • Cut and paste the table into a text file. I called mine “risk_matrix_raw.txt”
  • Create an awk file (mine was called risk_matrix.awk) with the following lines:
/<tr>/{printf("\n")}
/<td/{printf("%s~", $2)}
  • awk the text file, then pipe into sed to remove some of the tags
awk95 -F">" -f risk_matrix.awk risk_matrix_raw.txt |^ sed -e "s/<\/tr//g" -e "s/<\/td//g" \> risk_matrix.txt
  • Open the .txt file in Excel. When I did this, Excel asks whether its a fixed width or a delimited file. I specified that the file was delimited with a ‘~’ and Excel opened it.

Note (April 2020): for some reason in the original version of this post I had the code in .jpg files. Mea culpa. I’ve typed the code in, but not been able to test as yet, so, just for reference here are the original .jpgs

Awk commands Sed command

opatch error: Perl lib version (v5.8.3) doesnt match executable version (v5.6.1) at x:/oracle...

Got the following error:

C:\oracle\ora92\OPatch>perl opatch.pl version
Perl lib version (v5.8.3) doesn't match executable version (v5.6.1) at x:/oracle/10.2.0/perl/5.8.3/lib/MSWin32-x86-multi-thread/Config.pm line 32.
Compilation failed in require at x:/oracle/10.2.0/perl/5.8.3/lib/MSWin32-x86-multi-thread/lib.pm line 6.
BEGIN failed--compilation aborted at x:/oracle/10.2.0/perl/5.8.3/lib/MSWin32-x86-multi-thread/lib.pm line 6.
Compilation failed in require at opatch.pl line 88.
BEGIN failed--compilation aborted at opatch.pl line 88.

Kind of obvious, but the fix here is to set your PERL5LIB variable correctly…

C:\oracle\ora92\OPatch>set PERL5LIB=C:\perl\lib
C:\oracle\ora92\OPatch>perl opatch.pl version

Oracle Interim Patch Installer version 1.0.0.0.57
Copyright (c) 2007 Oracle Corporation. All Rights Reserved..

We recommend you refer to the OPatch documentation under
OPatch/docs for usage reference. We also recommend using
the latest OPatch version. For the latest OPatch version
and other support related issues, please refer to document
293369.1 which is viewable from metalink.oracle.com

OPatch Version: 1.0.0.0.57 

instType uknown

Started getting this error from a batch job which was using oradim to do a shutdown.

instType unknown: db not started; use RDBMS as default

I think this has just been occurring since we put a 10G install on the same server as the existing 9i and 8i databases.

Anyhow it was fixed by explicitly setting ORACLE_HOME and prefixing oradim with %ORACLE_HOME%\bin

instType uknown

Started getting this error from a batch job which was using oradim to do a shutdown.

instType unknown: db not started; use RDBMS as default

I think this has just been occurring since we put a 10G install on the same server as the existing 9i and 8i databases.

Anyhow it was fixed by explicitly setting ORACLE_HOME and prefixing oradim with %ORACLE_HOME%\bin

Determining which CPUs have been applied

The question of how to determine which CPUs have been applied to a database came up at a couple of presentations at the UKOUG, including mine.

A quick and dirty way (which I didn’t think of at the time) would be to look in the CPU directory:


c:> dir t:\oracle\ora92\cpu

11/06/2007  18:12     .
11/06/2007  18:12     ..
02/05/2006  17:30     CPUApr2006
30/04/2007  19:21     CPUApr2007
28/03/2006  18:51     CPUJan2006
......

Then to check which databases the catcpu script was run against, you can look in the directories themselves - the spoolfiles have the name of the database in the title:


c:> dir t:\oracle\ora92\cpu\CPUApr2007

30/04/2007  19:21            .
30/04/2007  19:21            ..
30/04/2007  18:19    4,918   APPLY_SID1_30Apr2007_19_19_49.log
30/04/2007  18:26    4,918   APPLY_SID2_30Apr2007_19_20_11.log 

Determining which CPUs have been applied

The question of how to determine which CPUs have been applied to a database came up at a couple of presentations at the UKOUG, including mine.

A quick and dirty way (which I didn’t think of at the time) would be to look in the CPU directory:

c:> dir t:\oracle\ora92\cpu

11/06/2007  18:12     .
11/06/2007  18:12     ..
02/05/2006  17:30     CPUApr2006
30/04/2007  19:21     CPUApr2007
28/03/2006  18:51     CPUJan2006
......

Then to check which databases the catcpu script was run against, you can look in the directories themselves - the spoolfiles have the name of the database in the title:


c:> dir t:\oracle\ora92\cpu\CPUApr2007

30/04/2007  19:21            .
30/04/2007  19:21            ..
30/04/2007  18:19    4,918   APPLY_SID1_30Apr2007_19_19_49.log
30/04/2007  18:26    4,918   APPLY_SID2_30Apr2007_19_20_11.log 

Problem: TNS-03505: Failed to resolve name

We’re in the process of migrating from Oracle Names to LDAP, and found the following fairly trivial gotcha.

If you have a space between the word LDAP and the comma in the DIRECTORY_PATH, as below, then it won’t work

NAMES.DIRECTORY_PATH= ( LDAP , ONAMES, TNSNAMES) 

Oracle options - update from Niall

Subsequent to the previous post I got a note from Niall, saying that

at least in 10g you can query dba_feature_usage_statistics as follows

SELECT NAME,VERSION,DETECTED_USAGES FROM DBA_FEATURE_USAGE_STATISTICS WHERE DETECTED_USAGES > 0;

Thanks, Niall!

Most used tiddlywiki commands for MainMenu

I put this into my MainMenu tiddler to give me a quick reference for my most used tiddlywiki formatting commands.

!Cheat sheet
|''Bold''|{{{''text''}}}|
|__Uline__|{{{__text__}}}|
|//Italic//|{{{//text//}}}|
|Bullets|{{{*text}}}|
|No.s|{{{#text}}}|
|Heads|{{{!text}}}|
|Table|{{{|t|t|}}}|
|Quote|{{{>>>}}}|
|{{{Mono}}}|{{{{{{text}}}}}}|
|[[Tid]]|{{{[[Text]]}}}|
|[[Help|http://www.blogjones.com/TiddlyWikiTutorial.html#EasyToEdit]]|{{{[[t|url]]}}}|

DOS equivalent to unix find -name -print

I’m planning to type up a couple of DOS and Windows equivalents of some of my most used unix commands.

These are very much limited, partial equivalents. In this particular case, I’m not replicating all the functionality of the unix ‘find’, but 9 times out of 10 when I use find, I use it like this:


find . -name 'sqlnet.ora' -print

You could of course use the Windows Explorer search. However, this doesn’t help if you want to, say, save the results into a text file or process them in a batch script. And, also, I prefer the commandline!

Anyhow, my quick and dirty DOS equivalent is:


dir /B /S sqlnet.ora


Some explanation, if its needed:

  • The /S says do a recursive listing
  • The /B is actually do a ‘bare’ listing with no size or date info. In this context though its use is that it prefixes the directory onto the output for each file

DOS equivalent to unix find -name -print

I’m planning to type up a couple of DOS and Windows equivalents of some of my most used unix commands.

These are very much limited, partial equivalents. In this particular case, I’m not replicating all the functionality of the unix ‘find’, but 9 times out of 10 when I use find, I use it like this:

find . -name 'sqlnet.ora' -print

You could of course use the Windows Explorer search. However, this doesn’t help if you want to, say, save the results into a text file or process them in a batch script. And, also, I prefer the commandline!

Anyhow, my quick and dirty DOS equivalent is:

dir /B /S sqlnet.ora

Some explanation, if its needed:

  • The /S says do a recursive listing
  • The /B is actually do a ‘bare’ listing with no size or date info. In this context though its use is that it prefixes the directory onto the output for each file

Bookmarking Oracle Metalink in IE or Firefox

This may well be obvious, but….

If you try and save the link to a Metalink note whilst you are actually in the Note, it doesnt always work very well.

Typically you get:

  • Name:ShowDoc

  • URL:https://www.metalink.oracle.com/metalink/plsql/f?p=130:14:42099925743 7239999::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_b lack_frame,p14_font:NOT,1066139.6,1,1,1,helvetica,yada,yada,yada

There are two problems with this:

  • the Name’s not very useful, and more significantly,
  • the URL won’t work

The URL doesn’t work because of the string of numbers prior to the 4 consecutive colon’s. My guess is that this represents the login credentials of your current session, and these won’t work once you terminate that session or after you’ve re-booted your PC.

I currently use a couple of workarounds for this. Both involve right-clicking on a link to the page you’re currently on, so one way or another you have to navigate away from that page. It’s a bit manky, but it does seem to work.

Either:

  1. Go to the top of the note
  2. click on the ‘Bookmark’ link (at the top right).
  3. This takes you into your own personal list of Metalink bookmarks.
  4. Right-clink on the bookmark you’ve just saved
  5. select ‘Bookmark this link’ (Firefox), ‘Add to Favourites’ (IE)

Sporadically I then delete all of the bookmarks on my Metalink bookmark page.

Or:

  1. Use the back arrow, to go back to the page you came from
  2. Right-clink on the bookmark you’ve just saved
  3. select ‘Bookmark this link’ (Firefox) or ‘Add to Favourites’ (IE)

You then get the title of the note in the Bookmark, and a working URL. You need to already be logged into Metalink for it to work, though.

I think I had this working with del.icio.us as well, but since there was some sort of change to the Metalink login, the URL of the page doesn’t persist through the login screen.

Bookmarking Oracle Metalink in IE or Firefox

This may well be obvious, but….

If you try and save the link to a Metalink note whilst you are actually in the Note, it doesnt always work very well.

Typically you get:

  • Name:ShowDoc

  • URL:https://www.metalink.oracle.com/metalink/plsql/f?p=130:14:42099925743 7239999::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_b lack_frame,p14_font:NOT,1066139.6,1,1,1,helvetica,yada,yada,yada

There are two problems with this:

  • the Name’s not very useful, and more significantly,
  • the URL won’t work

The URL doesn’t work because of the string of numbers prior to the 4 consecutive colon’s. My guess is that this represents the login credentials of your current session, and these won’t work once you terminate that session or after you’ve re-booted your PC.

I currently use a couple of workarounds for this. Both involve right-clicking on a link to the page you’re currently on, so one way or another you have to navigate away from that page. It’s a bit manky, but it does seem to work.

Either:

  1. Go to the top of the note
  2. click on the ‘Bookmark’ link (at the top right).
  3. This takes you into your own personal list of Metalink bookmarks.
  4. Right-clink on the bookmark you’ve just saved
  5. select ‘Bookmark this link’ (Firefox), ‘Add to Favourites’ (IE)

Sporadically I then delete all of the bookmarks on my Metalink bookmark page.

Or:

  1. Use the back arrow, to go back to the page you came from
  2. Right-clink on the bookmark you’ve just saved
  3. select ‘Bookmark this link’ (Firefox) or ‘Add to Favourites’ (IE)

You then get the title of the note in the Bookmark, and a working URL. You need to already be logged into Metalink for it to work, though.

I think I had this working with del.icio.us as well, but since there was some sort of change to the Metalink login, the URL of the page doesn’t persist through the login screen.

DOS script to output contents of latest file matching a given spec

Some of our batch jobs write log information to standard output. Others create dated log files.

Our scheduling tool kind of works best if log information goes to standard output - it captures it then allows you to inspect it from console.

I wrote the following script to spool out the latest version of a given dated log file.

I called it show_log.bat So if you run it as follows:


cmd /k show_log d:\logfiles\my_batch_job_*.log

…it displays the latest my_batch_job_*.log that it can find, where * is any string - in our case typically a date of some sort. So I put a call to show_log at the end of each batch job which creates a dated log file and I can see it from the scheduler console too.

If you have a directory that is called my_batch_job_*.log it wouldn’t work so well - I had to use /S to get dir to return the full pathname for the file.


echo off

rem This routine accepts a file specification (in the
rem format you use for rem dir) as a paremeter, then
rem displays the last updated file matching that
rem specification to stdout
rem
rem It replaces log2stdout.pl

set DIR_STRING="%1"
echo Dir String %DIR_STRING%

rem
rem These couple of lines work out what the last
rem updated file is. The dir command orders by
rem the updated date. The /S means do a recursive
rem search. This is there to ensure that the dir
rem returns the full path name rather than to
rem actually search a directory structure.
rem
rem We would get unexpected results if the
rem dir_string does actually match
rem a directory.

set LAST_FILE=
for /f %%I in ('dir /B /N /S /OD %DIR_STRING% ') do set LAST_FILE=%%I
echo Last file is %LAST_FILE%

if "%LAST_FILE%"=="" exit

rem
rem Retreiving the date stamp of the file for display

for /f "tokens=1,2" %%I in ('dir %LAST_FILE% ^| findstr /V "Volume Directory ( ^$"')  do set DATE_CREATED=%%I %%J
echo Date created is %DATE_CREATED%

echo Going to output this file:
dir %LAST_FILE% | findstr /V "Volume Directory ( ^$"
echo -----

rem
rem Echoing line by line rather than simply using
rem 'type' because I wanted to prefix each line
rem with the files datestamp. The reason for this is
rem because I don't want there to be any confusion
rem as to what file is being looked at, either
rem because this script has failed or because
rem the file you're expecting hasn't actually
rem been created

for /F  "delims=" %%I in (%LAST_FILE%) do echo %DATE_CREATED% Log: %%I

exit


DOS script to output contents of latest file matching a given spec

Some of our batch jobs write log information to standard output. Others create dated log files.

Our scheduling tool kind of works best if log information goes to standard output - it captures it then allows you to inspect it from console.

I wrote the following script to spool out the latest version of a given dated log file.

I called it show_log.bat So if you run it as follows:


cmd /k show_log d:\logfiles\my_batch_job_*.log

…it displays the latest my_batch_job_*.log that it can find, where * is any string - in our case typically a date of some sort. So I put a call to show_log at the end of each batch job which creates a dated log file and I can see it from the scheduler console too.

If you have a directory that is called my_batch_job_*.log it wouldn’t work so well - I had to use /S to get dir to return the full pathname for the file.


echo off

rem This routine accepts a file specification (in the
rem format you use for rem dir) as a paremeter, then
rem displays the last updated file matching that
rem specification to stdout
rem
rem It replaces log2stdout.pl

set DIR_STRING="%1"
echo Dir String %DIR_STRING%

rem
rem These couple of lines work out what the last
rem updated file is. The dir command orders by
rem the updated date. The /S means do a recursive
rem search. This is there to ensure that the dir
rem returns the full path name rather than to
rem actually search a directory structure.
rem
rem We would get unexpected results if the
rem dir_string does actually match
rem a directory.

set LAST_FILE=
for /f %%I in ('dir /B /N /S /OD %DIR_STRING% ') do set LAST_FILE=%%I
echo Last file is %LAST_FILE%

if "%LAST_FILE%"=="" exit

rem
rem Retreiving the date stamp of the file for display

for /f "tokens=1,2" %%I in ('dir %LAST_FILE% ^| findstr /V "Volume Directory ( ^$"')  do set DATE_CREATED=%%I %%J
echo Date created is %DATE_CREATED%

echo Going to output this file:
dir %LAST_FILE% | findstr /V "Volume Directory ( ^$"
echo -----

rem
rem Echoing line by line rather than simply using
rem 'type' because I wanted to prefix each line
rem with the files datestamp. The reason for this is
rem because I don't want there to be any confusion
rem as to what file is being looked at, either
rem because this script has failed or because
rem the file you're expecting hasn't actually
rem been created

for /F  "delims=" %%I in (%LAST_FILE%) do echo %DATE_CREATED% Log: %%I

exit


Moving to netbackup - its case sensitive....

We’re currently migrating our backups from TSM to netbackup.

I know TSM quite well, but I’m learning netbackup.

The first lesson was that its case-sensitive on Windows:

bplist  -R d:\backup
   EXIT STATUS 227: no entity was found

fixed by

bplist  -R D:\backup
   D:\backup
   D:\backup\MTP1
   D:\backup\MTP1\DB_MTP1_5_1_605982503_05I1T3P7_1_1
   D:\backup 

Missed email alerts because 'Sent' date missing

I scripted our backup jobs to send an email to me if there’s a problem. This works well enough, usually.

However this week the backups started failing because of a dodgy disk, but it seemed I wasn’t getting the alerts. It wasn’t until one of the sysadmins mentioned the problem with the disk that I found out there was a problem. I made a mental note to check out why I hadn’t been alerted but, so far, hadn’t got any further than that.

As it turns out the alerts weren’t failing, but were being created with no ‘Sent’ date, and for some reason I must have chosen to display the ‘Sent’ time rather than the ‘Received’ time in Outlook, and to sort by it.

So, the email alerts were coming in to the bottom of my Inbox where in the normal course of events I’d never see them. Doh!

I need to implement some sort of positive check on the success of the backups - in previous jobs I’ve set up a directory listing of the directory with the backup files in and incorporated that in a daily check. I’ll probably do the same again.

Missed email alerts because 'Sent' date missing

I scripted our backup jobs to send an email to me if there’s a problem. This works well enough, usually.

However this week the backups started failing because of a dodgy disk, but it seemed I wasn’t getting the alerts. It wasn’t until one of the sysadmins mentioned the problem with the disk that I found out there was a problem. I made a mental note to check out why I hadn’t been alerted but, so far, hadn’t got any further than that.

As it turns out the alerts weren’t failing, but were being created with no ‘Sent’ date, and for some reason I must have chosen to display the ‘Sent’ time rather than the ‘Received’ time in Outlook, and to sort by it.

So, the email alerts were coming in to the bottom of my Inbox where in the normal course of events I’d never see them. Doh!

I need to implement some sort of positive check on the success of the backups - in previous jobs I’ve set up a directory listing of the directory with the backup files in and incorporated that in a daily check. I’ll probably do the same again.

Changing the DOS prompt

I’m mucking about with VSS from the command line.

To do this you need to be in the VSS directory, which looks like this, for me:

     C:\Program Files\Microsoft Visual Studio\VSS\win32>

This doesn’t leave much room for typing before the line starts wrapping.

This command:

    prompt $d$g

Sets the prompt to:

    31/08/2006>

Which is a bit better….

Changing the DOS prompt

I’m mucking about with VSS from the command line.

To do this you need to be in the VSS directory, which looks like this, for me:

     C:\Program Files\Microsoft Visual Studio\VSS\win32>

This doesn’t leave much room for typing before the line starts wrapping.

This command:

    prompt $d$g

Sets the prompt to:

    31/08/2006>

Which is a bit better….