Wednesday, August 31, 2016

Performance related trace-flags for SQL Server 2005 & 2008


I mostly wanted to post this in order to record it for later reference.
If you're interested in these flags, please proceed to the MS Support site using the following link.

https://support.microsoft.com/en-us/kb/920093?sd=rss&spid=16139
 

Tuesday, August 09, 2016

Chat doesn't work in WOT for XBox One, but works elsewhere

I've recently had an issue with my chat not working in WOT for XB1, but working everywhere else.
To resolve, I had to do a hard restart on the console.
Hold the power-button down for quite some time (about 10 seconds) to power down the console entirely.
When it came back up, chat worked.

Good luck!

Saturday, April 30, 2016

Netbeans Issues with tableChanged event for JTable

I've struggled most of the day today to get the tableChanged() event to fire for a JTable I created to link to a database table, and wanted to share my solution.

As the linked video shows, after creating a custom listener that implements TableModelListener, and adding the listener to the table model object, the listener refused to fire.

Long story short, the answer turned out to be that I had failed to provide a name for the Default elements binding object. (See screenshot immediately below)

























Here is a video of me demonstrating this phenomenon more thoroughly. I hope you find it instructive.



Wednesday, April 27, 2016

SQL Server: T-SQL JOB to kill sessions with long-running transactions

We have a situation in a build/test server in which the application server (jboss, in this case) is unceremoniously killed by the build process.

This is leaving us with transactions that are not committed, nor are they rolled back. I like to call these zombies. SQL Server thinks they're just happily executing.

Because SQL Server has no server side lock, transaction, or query timeout, I developed this job to simulate a 10 minute transaction timeout.

It's not sophisticated, but it will give you a good starting point in case you should have to create your own .

if not exists (select * from sys.schemas where name = 'LOGSCHEMA')
EXEC ('CREATE SCHEMA [LOGSCHEMA] AUTHORIZATION [dbo]')
GO

if exists (select * from sys.tables where name = '#OLD_SPIDS')
EXEC ('DROP TABLE #OLD_SPIDS')
GO
 /* NOTE: In the following, I fully qualified the Kill_Long_Running_tran_log table as dbname.schema.tablename. DB_NAME will need to be changed */
if not exists (select * from sys.tables where name = 'Kill_Long_Running_tran_Log')
EXEC ('CREATE TABLE [/*change db_name */DB_NAME].[LOGSCHEMA].[Kill_Long_Running_tran_Log] (msg_timestamp datetime2(7), msg varchar(256))')

DECLARE @session_to_kill int = 0
DECLARE @kill_session_statement nvarchar(max)

select dtst.session_id
, dtst.transaction_id
, dtat.name
, dtat.transaction_begin_time
INTO #OLD_SPIDS
from sys.dm_tran_session_transactions dtst
join sys.dm_tran_active_transactions dtat
on dtst.transaction_id = dtat.transaction_id
where dtat.transaction_begin_time < DATEADD(MINUTE,-10,current_timestamp)

select @session_to_kill = session_id
from #OLD_SPIDS
where transaction_begin_time = (select min(transaction_begin_time) from #OLD_SPIDS )

select @kill_session_statement = 'kill ' + cast(@session_to_kill as varchar(10))

if (@session_to_kill != 0)
begin
insert into [LOGSCHEMA].[Kill_Long_Running_tran_Log]
values (current_timestamp, @kill_session_statement)
exec (@kill_session_statement)
end 

DROP TABLE #OLD_SPIDS

Tuesday, April 05, 2016

Windows - Cannot remove empty file

Encountered a weird one, today. Unfortunately, I did not get screen-shots.
When trying to delete a folder, I got a message that I could not because a sub-folder was open in another program.
Tried from command line, and it said that the folder was not empty.

Hmmm. That's odd ;-)

So I went folder by folder up the chain and found one that was marked as read-only.  I changed that setting, and was able to delete my folders.

Hope this help someone. Sorry for the lack of screen-shots.

ERROR: ORA-01033: ORACLE initialization or shutdown in progress

I recently ran across this error, which led me to this article in DBForums.
Unfortunately, it's been a while and I can't figure out my login, so I'm posting this here.

In my case, it was very definitely a user error :(
This was Oracle 12c, local development database on my laptop.
Because of space constraints, I had moved the USER tablespace to an external drive, and then forgot about it!

Oracle very happily started up and gave no visible objection, but when I tried to connect, it have this message.

So, long story short, if you get this, check that you can connect to all of your Oracle data files!

Happy databasing ;-)

Wednesday, March 30, 2016

MOVING ORACLE DATA FILES (Addendum)

There is a very good article on moving Oracle data files to be found here: https://docs.oracle.com/cd/B28359_01/server.111/b28310/dfiles005.htm

Unfortunately, it does no include a final step to bring the  tablespace back online.
The command is simple:

ALTER TABLESPACE USERS
 ONLINE;

So, execute the procedure in the link above, and when finished, make sure you bring your table-space back online.