Omega Owners Forum

Chat Area => General Discussion Area => Topic started by: jimbobmccoy on 30 March 2012, 00:55:17

Title: Stuck at work and booooooored
Post by: jimbobmccoy on 30 March 2012, 00:55:17
One of those weeks at work.
Accounts system up the creek, all sorts of fun and games with backups, restores unposting and reposting to get things in balance.
Now some twerp has screwed up the expos system and I'm waiting for a restore to finish before I can have the fun job of querying an SQL database that's in German.

Makes for figuring out which column is what an interesting chore.

It never rains but it pours, but at least I can hope to fill up the tank in an empty petrol station on the way home!!!!
Title: Re: Stuck at work and booooooored
Post by: TheBoy on 30 March 2012, 09:12:56
I could lend a hand - I'm great at mistyping SQL UPDATE commands ::)
Title: Re: Stuck at work and booooooored
Post by: tunnie on 30 March 2012, 09:25:12
rollback
--commit

 ::)
Title: Re: Stuck at work and booooooored
Post by: jimbobmccoy on 30 March 2012, 09:28:20
 ;D
Oddly enough I did think of you as I was sat there!
It was a fairly simple update from one column in one table in one database, to the same column, in the same table in a second database.
Having been up for a loooong time when it came time to run it I did stop and think "now what would theboy do?"

And so then I triple checked it and ran it on a test database twice  :D :D
Title: Re: Stuck at work and booooooored
Post by: cem_devecioglu on 30 March 2012, 09:30:07
rollback
--commit

 ::)

Tunnie , some databases are autocommit .. so you dont have chance to rollback.. unless you change the configuration parameters.. so its a good practice to arrange those when installing.. also most sql setups use single cpu and low memory usage..
Title: Re: Stuck at work and booooooored
Post by: jimbobmccoy on 30 March 2012, 09:33:58
The error (some numptys screwup) and how the database is set up meant a rollback wasnt possible and a plain restore would have affected other areas of the system (goods in, replenishments to stores etc) so restoring to a new database and just pulling the column needed was best.

Mind you, the 21 hour restore from the offsite backup needs looking in to......completely unviable in a business
Title: Re: Stuck at work and booooooored
Post by: cem_devecioglu on 30 March 2012, 09:45:07
rollback
--commit

 ::)

Tunnie , some databases are autocommit .. so you dont have chance to rollback.. unless you change the configuration parameters.. so its a good practice to arrange those when installing.. also most sql setups use single cpu and low memory usage..

forgot to add , your only chance is to start with
begin transaction 
update ........
 
Title: Re: Stuck at work and booooooored
Post by: tunnie on 30 March 2012, 09:49:08
Yeah thats what I used in my SQL days, but to be honest I did not give a monkey about the company I was working for. Kinda hoped I would screw up their DB.  ;D

Title: Re: Stuck at work and booooooored
Post by: TheBoy on 30 March 2012, 11:17:34
rollback
--commit

 ::)
Depends on the database type, and config.  You generally need a BEGINTRANS to start as well ;)

OOF's MySQL is not configured for that due to the connectionless setup.

Besides, the commands were fully tested on the test server - shame I transposed part of the UPDATE on about the 4th command ::).  I did take a backup before starting, but wasn't worth restoring TBH.


//Edit, cem beat me to it
Title: Re: Stuck at work and booooooored
Post by: TheBoy on 30 March 2012, 11:26:16
;D
Oddly enough I did think of you as I was sat there!
It was a fairly simple update from one column in one table in one database, to the same column, in the same table in a second database.
Having been up for a loooong time when it came time to run it I did stop and think "now what would theboy do?"

And so then I triple checked it and ran it on a test database twice  :D :D
I wear Stetson hats :P ;)
Title: Re: Stuck at work and booooooored
Post by: Rods2 on 30 March 2012, 17:07:30
;D
Oddly enough I did think of you as I was sat there!
It was a fairly simple update from one column in one table in one database, to the same column, in the same table in a second database.
Having been up for a loooong time when it came time to run it I did stop and think "now what would theboy do?"

And so then I triple checked it and ran it on a test database twice  :D :D

Just make sure you put on your steel capped boots BEFORE you kick it.  ;) ;D ;D ;D ;D
Title: Re: Stuck at work and booooooored
Post by: tunnie on 30 March 2012, 17:16:40
rollback
--commit

 ::)
Depends on the database type, and config.  You generally need a BEGINTRANS to start as well ;)

OOF's MySQL is not configured for that due to the connectionless setup.

Besides, the commands were fully tested on the test server - shame I transposed part of the UPDATE on about the 4th command ::).  I did take a backup before starting, but wasn't worth restoring TBH.


//Edit, cem beat me to it

Yup, I used that too. Only in the live billing database though, sod everything else.

My SQL, like my linux skills now are very rusty  :(