This cleans up ‘terraform plan’ output as rendered in Azure Devops if you copy it into vim

%s/\\[[0-9;]*m//g

I think it’s just removing the colours


title: “veeam doesn’t put ‘Database was restored’ in the errorlog” description: "" lastmod: “2020-02-24” date: “2015-09-17” tags: [ “veeam” ] categories:

  • “2015” aliases: ["/2015/09/17/veeam-doesnt-put-database-was-restored-in-the-errorlog/"] draft: No publishdate: “2015-09-17” weight: markup: “md” url: /2015/09/17/veeam-doesnt-put-database-was-restored-in-the-errorlog/

I’m doing some testing of veeam restores, and I just noticed this.

Whereas normal ‘vanilla’ disk to disk restores report about themselves in the Sqlserver errorlog

2015-09-17 12:07:08.28 spid1028    Starting up database 'my_little_db'.
2015-09-17 12:07:08.29 spid1028    The database 'my_little_db' is marked RESTORING and is in a state that does not allow recovery to be run.
2015-09-17 12:07:08.54 spid1028    Starting up database 'my_little_db'.
2015-09-17 12:07:08.88 spid1028    CHECKDB for database 'my_little_db' finished without errors on 2015-09-16 17:00:01.930 (local time). This is an informational message only; no user action is required.
2015-09-17 12:07:08.88 Backup      Restore is complete on database 'my_little_db'.  The database is now available.
2015-09-17 12:07:08.89 Backup      Database was restored: Database: my_little_db, creation date(time): 2015/07/22(13:56:48), first LSN: 83:4401:37, last LSN: 83:4417:1, number of dump devices: 1, device information: (FILE=1,TYPE=DISK: {'D:mssql_backupmy_little_dbmy_little_dbbackup_2015_09_16_174516_8366043.bak'}). Informational message. No user action required.

…veeam restores only show ancillary messages

2015-09-17 12:04:39.79 spid815     Setting database option SINGLE_USER to ON for database my_little_db.
2015-09-17 12:04:43.11 spid1026    Starting up database 'my_little_db'.
2015-09-17 12:04:43.17 spid1026    CHECKDB for database 'my_little_db' finished without errors on 2015-09-16 17:00:01.930 (local time). This is an informational message only; no user action is required.
2015-09-17 12:04:43.26 spid1025    Setting database option AUTO_CLOSE to OFF for database my_little_db.

This is perhaps more of a feature of VSS then veeam itself.

Pre-Pogues years: 1977–1982

The future members of the Pogues first met when MacGowan (vocals), Peter “Spider” Stacy (tin whistle), and Jem Finer (banjo) were together in an occasional band called The Millwall Chainsaws in the late 1970s after MacGowan and Stacy met in the toilets at a Ramones gig at The Roundhouse in London in 1977.[6] MacGowan was already with The Nips, though when they broke up in 1980 he concentrated more on Stacy’s Millwall Chainsaws, who changed their name to The New Republicans.[citation needed]. Shane and Stacy performed their first gig as The New Republicans at Richard Strange’s Cabaret Futura in London’s Rupert Street Soho in the early months of 1981. Also on the bill that night were Soft Cell.

Some other stuff

The Pogues were an English or Anglo-Irish[a] Celtic punk band fronted by Shane MacGowan and others, founded in King’s Cross, London, in 1982,[1] as Pogue Mahone—an anglicisation by James Joyce of the Irish phrase póg mo thóin, meaning “kiss my arse”. Fusing punk influences with instruments such as the tin whistle, banjo, cittern, mandolin and accordion, the Pogues were initially poorly received in traditional Irish music circles—the noted musician Tommy Makem called them “the greatest disaster ever to hit Irish music”—but were subsequently credited with reinvigorating the genre.[2] The band later incorporated influences from other musical traditions, including jazz, flamenco, and Middle Eastern music.

some text

$Arguments
foreach ($A in $Arguments) {$A}
foreach ($A in $Arguments) {$A[3]}
foreach ($A in $Arguments) {$Arguments[3]}
foreach ($A in $Arguments) {$i++; $i}
foreach ($A in $Arguments) {$i++; if ($i -gt 0){$i=0;write-host "$String"; $String= ""} $String = $String + $A + " " }
foreach ($A in $Arguments) {if ($i -gt 0){$i=0;write-host "$String"; $String= ""} $String = $String + $A + " " ; $i++}
foreach ($A in $Arguments) {if ($i -gt 1){$i=0;write-host "$String"; $String= ""} $String = $String + $A + " " ; $i++}
$i = 0; foreach ($A in $Arguments) {if ($i -gt 1){$i=0;write-host "$String"; $String= ""} $String = $String + $A + " " ; $i++}

I’ve watched a couple of new-ish films recently in which the biggest star gets killed off quite early on. The only equivalent I can think of is Janet Leigh in Psycho. It’s a bit of a surprise, in any case.

"Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the '.' operator." after upgrade to Windows 11

After my laptop was upgraded from Windows 10 to Windows 11 I got the following when I tried to do anything much in #Powershell

“Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents, omit the ‘.’ operator.”

This was because, for some reason, the upgrade had re-pointed the System Environment variables TEMP and TMP.

The new folders pointed to by those variables are nobbled by our Software Restriction Policy. I amended the two variables to point at folders from which software is allowed to run and everything started working again.

This is the standard bit


$Token = 'whatever-the-token-is' | ConvertTo-SecureString -AsPlainText -Force

$Body = @{ content = 'Testing again. 1 , 2, 1, 2' h = 'entry' 'post-status' = 'draft' }

You then put ‘?mp-destination=’ followed by the URL of the test micro.blog on the end of the base URL as in the gist below. (The markdown conversion is nausing up the URL if I type it in here - sorry!


invoke-restmethod [micro.blog/micropub](https://micro.blog/micropub?mp-destination=https://mattypenny-test.micro.blog) -Method post  -Authentication Bearer -Token $Token -Body $Body

url                                                              preview                                                 edit
---                                                              -------                                                 ----
[mattypenny-test.micro.blog/2024/02/1...](https://mattypenny-test.micro.blog/2024/02/18/testing-again.html) [micro.blog/account/p...](https://micro.blog/account/posts/143155/preview/3875601) [micro.blog/account/p...](https://micro.blog/account/posts/143155/edit/3875601)

Dec 23, 2016

TodayILearned that Angelina Jolie has a Christopher Marlowe quotation as a tattoo goinswriter.com/austin-kl… via @jeffgoins 1

Nov 28, 2016

TodayILearned that the pincers of a scorpion are called ‘pedipalps’ and that baby scorpions are ‘scorplings’ abc.net.au/radio/pro…

Nov 23, 2016

jkjjhjhj


  1. The quotation is “Quod me nutrit me destruit”, which means “That which nourishes me destroys me.” There’s a discussion about Marlowe and the quotation here: “That Which Nourishes Me Destroys Me”: Christopher Marlowe and Our Deals with the Devil - Christ and Pop Culture ↩︎

Welcome to your test blog! You can create new posts here to test theme and design changes.

Problem: 'Access is denied. [0x80070005]' when changing sql server agent login

Trying to change the sql server agent to run as a non-admin user, I couldn’t get Sql Server Agent to work without giving it administrator privileges. I got:

---------------------------
WMI Provider Error
---------------------------
Access is denied. [0x80070005]
---------------------------
OK
---------------------------

You have to grant two privileges - both the Agent User and the MSSQL user.

  • SQLServerSQLAgentUser$bigserver$inst01
  • SQLServerMSSQLUser$bigserver$inst01

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

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 

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.

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


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….

Disabling/Enabling wsh

Here are instructions for disabling wsh. This is particularly used by DBAs to run RDA (Remote Diagnostic Agent) to gather Oracle and Oracle-related diagnostics.

  • Run regedit

  • Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings\Enabled (the Microsoft doc says to create it if its not there)

  • Set the value to 0

That’s it. You get the message:

Windows Script Host access is disabled on this machine. Contact your administrator for details.

If you try to use it.

If it needs to be re-enabled, then you set the value to 1 - we often need to use it on the database servers to get diags for Oracle, but we should disable it each time after use.

The MS reference is:

Ms ref

BJS Jobs going into 'Awaiting Execution' state

BJS is the scheduling tool we use on our Windows servers. Its produced by Camellia Software:

  • Camellia website

    ….and it’s very good.

    I had a problem this morning though.

BJS jobs would go into ‘Awaiting Exec’ state for up to 45 minutes before running.

The Log file would show:


* BATCH JOB SERVER
* A Camellia Software Product - www.CamelliaSoftware.com
* Copyright 1994-1998
* Version 2.1 - A Build 529
* ***** J O B L O G

JOB NO. 0737


Job Name: BIG Backup PWHC Open
Username: xxx
Submitted by:

Server: bigserver
Source File: \bigserverD$BJSbig_backup_pwhc_open.bat
Output Directory: D:BJSBJSWORK
*
***

>
> 11/04/05 08:00:29 PM Job scheduled for execution
>
> 11/04/05 08:45:00 PM Job started execution
>

The reason for this was/is that there is a setting under Server-Administer-Change Service Parameters called ‘Maximum Batch Job Processes’. This limits the number of jobs you can run at any one time. It should be set to twice the number of jobs you might want to have running conccurrently.

There is also a setting against Job Class which does something similar - under Server-Administer-Job Class Maintenance

A case of RTFM….