July 23, 2012 at 4:02 pm
I have a 22gb database with a column called [var]. I need to change this column from decimal(12,5) to decimal(22,7). The database must stay on-line and is collecting data 24/7. My overall free hard drive space is less than 20gb.
Looking for some help!
July 23, 2012 at 5:53 pm
Which part do you need help with?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 23, 2012 at 6:10 pm
July 23, 2012 at 6:11 pm
Do you have a test environment to test the changes first with a table of the same size?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 24, 2012 at 6:01 am
15.7 gb
July 24, 2012 at 6:02 am
Yes I have a dev box that I can test on.
July 24, 2012 at 6:04 am
I need help with making the field change without doubling/tripling the size of the table to make the change. I have tried the alter table/ alter column and I ran out of disk space. So the real issue here is to be able to make the field size change when the database table is about the same size as my free space on the drive.
July 24, 2012 at 10:10 am
What is the tsql you used to make the change? Are you dumping the table into a temp table and then renaming that temp table and replacing the actual table or are you doing something like the following?
Given a table such as this
CREATE TABLE dbo.Employee
(
EmployeeID INT IDENTITY (1,1) NOT NULL
,FirstName VARCHAR(50) NULL
,MiddleName VARCHAR(50) NULL
,LastName VARCHAR(50) NULL
,DateHired datetime NOT NULL
)
Use this to increase the size of the FirstName filed to 100 characters.
ALTER TABLE dbo.Employee
ALTER COLUMN FirstName VARCHAR(100)
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 24, 2012 at 10:57 am
This is the exact code that I tried. The disk space started out at 20gb free and when it got down to 2gb free, I cancelled the job.
July 24, 2012 at 11:23 am
July 24, 2012 at 11:42 am
Yup, add a new nullable column, update in small batches running log backups between the batches to prevent the log from blowing out (that's probably what used all the space).
Or create a new table, move the data over in chunks and delete the old table when done
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply