DB Engine :: Deleting A Log File Permanently?
Jul 6, 2015
In SQL 2012 I'm trying to delete a log file (both physically and logically). There are two log files and one of them is unnecessary. When I click 'remove' in SSMS it will delete the log file, but then when I go back under database properties it's still showing up even though the file has been physically removed from the OS. I'm wondering what steps I can take to get rid of the file permanently?
View 12 Replies
ADVERTISEMENT
Aug 3, 2015
I've a spatial (GIS) Data which is used frequently insertion, updation.
5 lakh records insertion in daily basis. when I trying to generate reports last 3 days or one weak, it takes 20-30 minute.
very disappointing while playing with clients. how to boostup and perform fast.
I think as so once we set query plan in buffer permanently then i would be faster than ever.
View 4 Replies
View Related
Mar 14, 2008
I have recently installed SQL server 2005 express edition along with Sql server management studio expressI have run the installation twice and during the installation I have created two instances of SQL server one named instance having Windows authentication and the other default instance having mixed mode authentication. Now I want to delete the named instance. Could anybody tellme I can delete the named instance?
View 3 Replies
View Related
Aug 5, 2015
I have many large tables with millions of records in a SQL Server database. They all use an Identity column which is the clustered index. We haven't been deleting any records until recently because disk space is now becoming a problem.
Assuming I delete a lot of old records, I'm thinking that the freed up space in the data pages won't be reused. New records will be added at the end of the table because of the Identity column being the clustered index. So the table will keep getting bigger even though there is lots of free space.
Assuming I'm right, then how do I recapture this unused space? Is an alter table rebuild the best way? Or rebuilding the clustered index?
View 2 Replies
View Related
Jun 29, 2015
Ok so I have some dynamic sql to delete a file that is created via sql earlier on. It is to provision a copy of a database to an instance on link server. Everything works great and the files used to delete. Now, with no code changes it is throwing a syntax error. I do a print of what the dynamic sql is creating before executing and then I copy / paste what was generated into command prompt and guess what!! The file deletes.
Here is the result on screen:
@DeleteBackupFileStatement: DEL adas16.clients.advance.localwip$AvionteAP_Template_893.bak /Q
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ''.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ''.
Here is the code that creates the statement:
SET @DeleteBackupFileStatement = NULL
BEGIN
SET @DeleteBackupFileStatement = 'DEL ' + LTRIM(RTRIM(@BackupFile)) + ' /Q'
END
PRINT '@DeleteBackupFileStatement: ' + cast(@DeleteBackupFileStatement as varchar(400))
BEGIN
EXEC adasdb.master.sys.Sp_executesql
@DeleteBackupFileStatement
END
END
The value of @BackupFile is simply the path of the file with the file name, everything in the prepared statement with the exception of DEL and the switch at the end.
View 9 Replies
View Related
Jun 12, 2015
I have a requirement to delete 1 Million records from a table having 10 Million data and it's being queried on 24/7 basis (don't have a downtime). how can I achieve that?
View 13 Replies
View Related
Sep 22, 2015
What is the recommended size and file growth for a database and log file? We will be storing approx 10000 records a day.Currently we have the following:
CREATE DATABASE Dummy
ONÂ
PRIMARY
( NAME = Dummy_data,
  FILENAME = 'D:....DATADummy.mdf',
  SIZE = 250MB,
  FILEGROWTH = 25MB )
LOG ON
( NAME = Dummy_log,
  FILENAME = 'D:....DATADummy_log.ldf',
  SIZE = 50MB,
  FILEGROWTH = 5MB ) ;
GO
View 3 Replies
View Related
Jun 11, 2015
My customer got a total hard drive failure.After sending it to drive recovery specialist we were able to recover the LDF log file (MyDB_0.LDF).But the MDF file was completely destroyed (MyDB.MDF).They have a good full backup from a month ago.
1) Installed SQL Server 2012 on a new PC
2) Created a new database of same name (MyDB) - with same MDF and LDF file names as original
3) Took the new database offline
4) deleted the MDF and LDF files of the new database
5) put "MyDB_0.LDF" in the place of the LDF file I just deletedÂ
6) put the database back on-line
7) after hitting F5 to refresh databases - it shows "MyDB (Recovery Pending)"
8) tried to do Tail Log Backup with this command
  BACKUP LOG [MyDB] TO DISK = N'C:BACKUPMyDB_TailLog.bak'
WITH NO_TRUNCATE
And I get this error...
Msg 3447, Level 16, State 1, Line 3
Could not activate or scan all of the log files for database 'MyDB'.
The sad thing is I know we can get this data back using ApexSQL-Log. I can see all the transactions since the last full backup in this program - so the log file is not damaged. But my client doesn't want to pay the $2000 fee for this software.There has to be a way to restore this data, without having to purchase a third party tool.
View 13 Replies
View Related
Mar 5, 2001
How can you delete a log file.
Say I have backed up a transaction log at some drive say G:.
Now I want to delete this log file and want to define it in a job.
What is the syntax -
delete G:Test_log.bak ????
What is a proper syntax??
Thanks!
View 1 Replies
View Related
Apr 15, 2008
can some one please help me to delete a File with extension .mdf, as its continously giving error that file can't be deleted its being used by any other program or user.
Rahul Arora
07 Batch
NCCE Israna,
######################
IMPOSSIBLE = I+M+POSSIBLE
View 8 Replies
View Related
Apr 16, 2008
I am trying to remove the transaction log file since I have created another one on a seperate drive by it wont let me do it . I get this error "cant delete the primary data or log file"
Now microsoft site clearly state steps for deleting the transaction log file , by first emptying it and then deleting it BUT IT DOESNT WORK.
I have even tried detaching the database and then removing the transaction log file and then attaching the database again BUT it attaches the transaction file back again GRRRRRR
then on top of this MS SQL studio does not allow to put PRIMARY or anyother value to the Filegroup for tansaction log files so how on earth can a transaction file be "primary" as the error is stating ??????
can anyone tell me how to get rid of a transaction log file that was created with the database ?
View 4 Replies
View Related
Apr 4, 2006
Hi All
Was getting this error
Server: Msg 1101, Level 17, State 10, Line 1
Could not allocate new page for database 'TEMPDB'. There are no more pages available in filegroup DEFAULT. Space can be created by dropping objects, adding additional files, or allowing file growth.
So went to EM & added another file (Additional file in some other drive ) to the Tempdb , now I want to delete this file ???
What are the steps ... I cant re-start the SQL Server
Please help .
View 2 Replies
View Related
Oct 13, 2006
Hi,
I can not delete this file from C/Windows/Temp directory, all other files form that foder I can delete. The error message I get is that something else is using this file. The thing is I cant find what is using it, even though I uninstaled SQL Server 2005 completely. I have tried lots of things, nothing helps. At the end I entered windows in SAFE MODE, went to Computer Management and disabled almost every service I can, that might be using it, and still cant get rid of this SQL.LOG which is 26GB now. The only thing I could do is to compress the file and now it is 6.5GB.
Txs for the help..
View 1 Replies
View Related
May 8, 2015
I checked quickly one network  and I ran into the folders; I found out the folder MSSQL backup, nothing strange so far. Within that folder, anyway, I found out several backup and one very huge file (datawarehouse) with extension FILE. I am wondering what can be? I got datawarehouse mdf of course and datawarehouse log but what is that huge file (1 TB)?
View 6 Replies
View Related
Aug 18, 2014
Executed as user: S233683-AD01S233683NJ3SQL05. ...at file already exists.' [SQLSTATE 42000] (Error 22048) Â ERROR -- Could not backup database: master - BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 50000) Â xp_create_subdir() returned error 183, 'Cannot create a file when that file already exists.'
View 2 Replies
View Related
Jun 22, 2002
Hi ALL,
I need to delete 1st and last lines of text from a text file in an automated process,and save the file with the same name or a different name at the same location. How is that possible?Any help is greatly appreciated.
Thanks!!
Sai.
View 1 Replies
View Related
Aug 22, 2007
When I delete substantial amounts of data using the SQL DELETE command, the database size apparently remains the same (702 mb) and the log file goes from about 17 mb to over 1 gig. I was expecting for the overall size to decrease drastically, but got just the opposite.
Is this typical? Can I do something to slim it down? As I am just trying to decrease the overall size to make it easier to work with when creating my application in VB, I am not worried about restoring the db (I have secure copies).
View 15 Replies
View Related
May 29, 2007
I have a flat file that look like this
############################################################
# Market Issue Lookup
# Applies to: Muni,Pfd,Govt,Corp
###########################################################
LU_MARKET_ISSUE| |AUSTRALIAN|Corp|
LU_MARKET_ISSUE| |BULLDOG|Corp|
LU_MARKET_ISSUE| |CANADIAN|Corp|
LU_MARKET_ISSUE| |WARRANTS|Muni|
LU_MARKET_ISSUE| |YANKEE|Corp|
############################################################
# Maturity Type Lookup
and i want it to look like this
LU_MARKET_ISSUE| |AUSTRALIAN|Corp|
LU_MARKET_ISSUE| |BULLDOG|Corp|
LU_MARKET_ISSUE| |CANADIAN|Corp|
LU_MARKET_ISSUE| |WARRANTS|Muni|
LU_MARKET_ISSUE| |YANKEE|Corp|
Basically remove any line that start with a "#" or any blank lines..
I am assuming you can do this only using a script component and not directly through ssis..but i am not too familiar with scripting...so some code would be helpful
Thanks for any help in advance.
smathew
View 5 Replies
View Related
May 27, 2006
My SQL Server 2000 database log was full (2MB) and I am unable to add new column to a table. So that I follow this article to truncate my log file to 1MB. It works. But when I add a new column to a table after that. The log file went back to 2MB in size and I got the "the log file is full" error message again for the operation. BTW, my reovery mode was set to "Simple". I don't understand how the save table operation can recover my change on log size. What should I do to "permanently" truncate my log?
http://www.support.microsoft.com/?id=272318
I did this:
DBCC SHRINKFILE (myDB_Log, 1)
BACKUP LOG myDB WITH TRUNCATE_ONLY
DBCC SHRINKFILE (myDB_Log, 1)
View 1 Replies
View Related
Sep 3, 2002
How, using SQL, do I turn off the identity property in the table? I need a script to run against a number of db to permanently remove the identity property from the tables without needing to use Enterprise Manager.
Thank you,
Jill
View 1 Replies
View Related
Apr 11, 2007
I use discountasp.net. I've added some new tables that I'd like to place on my website. My problem is that if I reattach my mdf file to my server, my member roster gets deleted. So my question is how can I update the mdf file without losing member information?
Thanks,JW
View 1 Replies
View Related
Feb 6, 2004
I have maually deleted the Database.LDF file by stopping the SQL Server. When i start the SQL Server, merge replication which was configured for the database does not work. How do i fix this problem.
Thanks in advance.
Regards,
Venu.
View 1 Replies
View Related
May 28, 2008
Hi,
I'm new to SQL Server 2005 (up until now I've been an Oracle DBA exclusively) and have been tasked with backing up all (6) of our SQL Server 2005 databases on a regular basis. To accomplish this, I've created individual SQL Server jobs for each database I wish to backup. Each of these jobs executes a T-SQL script like this:
BACKUP DATABASE [MYDATA] TO DISK = N'\networksharemydata.bak' WITH RETAINDAYS = 4,
NOFORMAT,
NOINIT,
NAME = N'MyData-FullBackup',
SKIP,
NOREWIND,
NOUNLOAD,
STATS = 10
GO
My goal in specifying 'RETAINDAYS = 4' was so that there would always be 4 days worth of "backupsets" (forgive my Oracle-ese) kept in mydata.bak. But when I look at the amount of backupsets kept in mydata.bak I noticed that all of them were being kept and none were being deleted.
I researched this problem a little bit and thought I had discovered a solution by specifying 'INIT' instead of 'NOINIT' and 'NOSKIP' instead of 'SKIP', but this deletes the entire contents of mydata.bak only-if all of the backupsets contained in it are past their expiration date. I was hoping it would just delete the expired backupsets and keep the non-expired ones, but this isn't the case.
Does anyone know the simplest way - with T-SQL commands - to accmplish the task of backing up a database to 1 individual .bak file and also only retain x amount of "backupsets" within it? Any help would be greatly appreciated, and the more detailed the better. Thanks.
- Gary
View 18 Replies
View Related
May 27, 2008
Hi,
I'm new to SQL Server 2005 (up until now I've been an Oracle DBA exclusively) and have been tasked with backing up all (6) of our SQL Server 2005 databases on a regular basis. To accomplish this, I've created individual SQL Server jobs for each database I wish to backup. Each of these jobs executes a T-SQL script like this:
BACKUP DATABASE [MYDATA] TO DISK = N'\networksharemydata.bak' WITH RETAINDAYS = 4,
NOFORMAT,
NOINIT,
NAME = N'MyData-FullBackup',
SKIP,
NOREWIND,
NOUNLOAD,
STATS = 10
GO
My goal in specifying 'RETAINDAYS = 4' was so that there would always be 4 days worth of "backupsets" (forgive my Oracle-ese) kept in mydata.bak. But when I look at the amount of backupsets kept in mydata.bak I noticed that all of them were being kept and none were being deleted.
I researched this problem a little bit and thought I had discovered a solution by specifying 'INIT' instead of 'NOINIT' and 'NOSKIP' instead of 'SKIP', but this deletes the entire contents of mydata.bak only-if all of the backupsets contained in it are past their expiration date. I was hoping it would just delete the expired backupsets and keep the non-expired ones, but this isn't the case.
Does anyone know the simplest way - with T-SQL commands - to accmplish the task of backing up a database to 1 individual .bak file and also only retain x amount of "backupsets" within it? Any help would be greatly appreciated, and the more detailed the better. Thanks.
- Gary
View 2 Replies
View Related
Mar 6, 2007
I hope this is the right forum to post my question in.
Does anyone know if or when Microsoft will discontinue support for 2000 DTS Legacy packages within SQL Server 2005? We€™re in the process of migrating from 2000 to 2005 and have a lot of packages to migrate to Integration Services. We€™re having problems migrating the packages because quite a few of them are complex and won€™t run after migrating to IS without a major rewrite. Right now it seems that those packages will run just fine under the Legacy folder on the 2005 instance with the data connections pointed to 2005 databases. We€™d just like to plan appropriately if we absolutely have to migrate those packages to IS at some point soon. We realize that we'll need to create new packages using IS, though.
So I€™d appreciate it if anyone has heard anything to please let me know. I apologize if this has been asked before, but I couldn€™t seem to find any posts on it.
Thanks!
View 4 Replies
View Related
Aug 18, 2015
How can we delete the column from SSIS file using ssis?
View 3 Replies
View Related
Mar 17, 2008
In SQL 2005, I've created a test scenario in AdventureWorks where I:
1.) Create a database master key:
IF NOT EXISTS (SELECT * FROM sys.symmetric_keys WHERE symmetric_key_id = 101)
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<password>'
GO
2.) Create a certificate:
CREATE CERTIFICATE HRCert
WITH SUBJECT = 'Comments'
GO
3.) Create a symmetric key:
CREATE SYMMETRIC KEY CommentKey
WITH ALGORITHM = DES
ENCRYPTION BY CERTIFICATE HRCert
GO
4.) Add a test column to the HumanResources.JobCandidate table:
ALTER TABLE HumanResources.JobCandidate
ADD Comments varbinary(8000)
GO
5.) Open the symmetric key for use:
OPEN SYMMETRIC KEY CommentKey
DECRYPTION BY CERTIFICATE HRCert
GO
6.) Insert and Encrypt values ('Yes') to the newly created column:
UPDATE HumanResources.JobCandidate
SET Comments = EncryptByKey(Key_GUID('CommentKey'), 'Yes')
GO
-------
Great. Now all the textbooks say that, to view the column values in a decrypted state, you should:
SELECT CONVERT(varchar, DecryptByKey(Comments)) AS [Decrypted Comments], *
FROM HumanResources.JobCandidate
------
Great, I get it. But here's the rub. What is the best way to permanently decrypt the column and keep it in a cleartext state?
Running the following works, but keeps the column values in a varbinary (hexadecimal) state which is what we originally created:
UPDATE HumanResources.JobCandidate
SET Comments = DecryptByKey(Comments)
GO
But if I want to transform this varbinary(8000) column into a human-readable varchar column, the only thing I could come up with was a temp table solution:
UPDATE HumanResources.JobCandidate
SET Comments = DecryptByKey(Comments)
GO
DECLARE @temp varchar(1000)
SET @temp = (SELECT TOP 1 CommentsFROM Human Resources.JobCandidate)
CREATE TABLE #decrypt (Comment varchar(1000))
INSERT INTO #decrypt (Comments) VALUES (@temp)
GO
ALTER TABLE HumanResources.JobCandidate
ALTER COLUMN Comments varchar(1000)
GO
UPDATE HumanResources.JobCandidate
SET Comments = (SELECT Comments FROM #decrypt)
GO
DROP TABLE #decrypt
GO
--------
It works, but seems so inelegant to me.
Is there an easier way?
View 5 Replies
View Related
Jul 23, 2005
Dear group,I have to replicate remote data to a SQL Server in the headquarter.The data are on a site which does not have permanent online-connectionto the headquarter.I have written a script which replicates the data and i want to set upa process / batch on the headquarter-machine which roughly does thefollowing1) Connect to the remote site2) start replication script (in fact a stored procedure)3) on success disconnect from the remote siteAll this has to run automatically e.g. during nighttime.Could someone please outline how i set up the connection and keep itup during my database-action and how to automatically disconnect aftersuccess of my replication script.I'd be jolly grateful.Thanks in advance and Greetings from ViennaUli
View 1 Replies
View Related
Aug 24, 2015
I have stored procedure which runs on some period, what i want is when it first run i want to store that date permanently or till the next time it runs again, and then i need to take my data from that store proc , where hist_date between (date stored when it ran first time,example, 08/21/2015) and today date.(exampple, 08/24/2015)
Now next time when it runs , date stored should be updated in this case it should be (08/24/2015) .
How can i do this in stored proc, I tried to use temp table  but it didn't work .
View 13 Replies
View Related
Aug 9, 2007
Hi
i have to delete the master table data without deleting the child table records,is there any solution for this, parent table has relation with the child table.
regards
vinod.t.v
View 9 Replies
View Related
May 13, 2015
User A creates the SSIS Package and provides the password for the connection manager for a task (for OLE DB source) with SQL authentication.Â
When User B tries to run the SSIS package, the error is thrown as : The package may be damaged.
On typing the password again inside the connection manager, the execution occurs successfully. Is there any workaround to save the password permamanently for the connection manager rather than each user entering it in order to run the package ?
View 4 Replies
View Related
Jul 21, 2015
last couple of months we're getting automatically generate jobs under sql server job event. causing occupy the resources.
in daily basis i've to remove mannualy. i've do disable the job no of times from properties, but it generates again.
how to remove it permanently. following are the job which generates automatically-
15559-cook.exe,
15564-dbdotas
15565-dbdotas2
15552-ftpbacks.exe
15554-install.exe
15555-kills.exe
15557-kugou2010
15558-macs.exe
15553-pdoors.exe
15561-regs.exe
15562-regsa.exe
View 9 Replies
View Related
Jan 16, 2008
I have the following issue with Maintenance plan backups that work for BAK DIF and TRN to a remote server share.
When I try and remove the old files with a clean up task I get an error and the files don't get deleted.
The version is as follows
Microsoft SQL Server 2005 - 9.00.3054.00 (X64) Mar 23 2007 18:41:50
Copyright (c) 1988-2005 Microsoft Corporation Standard Edition (64-bit) on
Windows NT 5.2 (Build 3790: Service Pack 2)
The error result is as follows,
Failed-1073548784) Executing the query "EXECUTE master.dbo.xp_delete_file
0,N'\\EXECUTE master.dbo.xp_delete_file 0,N'\ABCD-A1\BACKUPS\ABCD_BACKUP\ABC_DAILY\ABCD',N'trn',N'2008-01-13T12:52:49'" failed with the following error: "xp_delete_file() returned error 2, 'The
system cannot find the file specified.'". Possible failure reasons: Problems
with the query, "ResultSet" property not set correctly, parameters not set
correctly, or connection not established correctly.
The maintenance plan seems to be adding extra "" though when i enter the
code directly in a query i get same error.
Query:
EXECUTE master.dbo.xp_delete_file 0,N'\ABCD-A1BACKUPSABCD_BACKUPABC_DAILYABCD',N'trn',N'2008-01-13T12:52:49'
Error:
xp_delete_file() returned error 2, 'The system cannot find the file specified.'
The servers belong to the same domain and are using the same Service account which has all the necessary rights to the share and the file directory location. The backups work but i get the error on the cleanup task.
Trying to figure out how to get the Cleanup task to delete old files. The same happens for all file extensions and I have tried other locations with simpler file paths same error.
Regards,
Scott
View 6 Replies
View Related