Quantcast
Channel: SQL Server Manageability forum
Viewing all 1519 articles
Browse latest View live

Reduce initial size of .mdf file of a database

$
0
0

Hello,

The database on one of my server's is running out of space. Is error is that there is no space on the drive which has the database the mdf file.

Here is a background on what has happened.

The disk space was full due to an bad T-SQL code . While the bad code which caused the error has been fixed and the table truncated, the OS hasn't got the storage space back. There are other data files from other DB located on the drive which is running out of diskspace.

I ran the DBCC shrinkfile it still doesn't release the disk space to the OS. Upon investigation found that the Initial Size of the mdf file was set to 1.76 TB. I figured the space used by the database mdf file was far less that the initial size. So I decided to set the Initial Size to the space used by the database file (instead of 1.76TB set currently) and then issue a DBCC shrinkfile.

The step to reduce the Initial Size to space used is running since a very long time.

Is there any better way to reduce the initial size of the db? I'd like to set it to the space currently used by the DB


Appreciate your inputs!


Monitoring concurrent updaters for a given table?

$
0
0

Is there a good way to see the max number of concurrent table updaters for a given table for a given time period? I suspect we may have two many threads simultaneously updating the same table (thereby causing slow updates and timeouts) but need some empirical evidence.

sql 2014

SQL Server 2014 - Change Tracking - Manual Cleanup

$
0
0

Hi,

We are using Change Tracking for our data warehouse ETL (SQL Server 2014 enterprise), and we're in the situation where the internal change tracking tables grow faster than the auto-cleanup sproc can clean it up (described here).  

I tried to use the sys.sp_flush_commit_table_on_demand sproc to control this, by issuing commands similar to the following:

ALTER DATABASE XYZ SET CHANGE_TRACKING (AUTO_CLEANUP = OFF);
EXEC sys.sp_flush_commit_table_on_demand ###;
ALTER DATABASE XYZ SET CHANGE_TRACKING (AUTO_CLEANUP = ON, CHANGE_RETENTION = 30 DAYS);

This will clear out data in the CT tables that is older than the retention period, but it won't delete anything that is still in the retention window.  However, there are certain occasions where we want to completely wipe out the CT tables.  I tried to run something like this:

ALTER DATABASE XYZ SET CHANGE_TRACKING (AUTO_CLEANUP = ON, CHANGE_RETENTION = 1 MINUTES);
ALTER DATABASE XYZ SET CHANGE_TRACKING (AUTO_CLEANUP = OFF);
EXEC sys.sp_flush_commit_table_on_demand ###;
ALTER DATABASE XYZ SET CHANGE_TRACKING (AUTO_CLEANUP = ON, CHANGE_RETENTION = 30 DAYS);

But it doesn't work - it still won't delete anything within the original 30 day window.  I also tried turning off change tracking in a table and turning it back on, as mentioned in this post, but this doesn't wipe out the internal CT tables.  Any thoughts on how to accomplish this?

Thanks!

backup clarifications

$
0
0

Hey all,
Thanks for previous replies regarding Always On.
I have some backup questions or maybe it’s just clarification and getting my head around log backups.
Trying to set up a maintenance plan and automate it.
I am looking at a full database backup at night and then probably 4 log backups, one every 6 hours.

Here is where I am a bit fuzzy when it comes to log backups.
Let’s say I get a full backup at 12:00 am and at 6:00 am a log backup kicks off. Then another log backup 6 hours later at 12:00 pm, another at 6:00 pm.
The system crashes at 7:05 pm, an hour and 5 minutes after the last log backup.
I restore the full backup from 12:00 am then restore the log backups from 6:00 am, 12:00 pm and then the final one at 6:00 pm.
In all I have lost one hour and five minutes of data, from the log backup at 6:00 pm to 7:05 pm when the crash occurred.
I have to restore all the log backups, in order as they are ‘cumulative’,

Let me stop at this point and ask is everything I have explained so far, in regards to backups and restores correct?

Now I’ll move on to my confusion of truncate.
When you truncate the transaction log, it is not necessarily going to shrink the size of the log (in file size) but instead is going to ‘mark’ the transactions committed to the .mdf file as committed and so they can be overwritten?
Is this correct?

If you do a full backup, followed by a log backup and you mark it “Truncate the Transaction Log” in Media options then it will do what I just explained essentially ‘clearing the log’.
Again, is this correct?

So finally to the question I am getting at;
If I right click on a database and select task and backup and select Log Backup then the Truncate the Transaction Log radio button is selected and cannot be un-selected.
I do NOT want the transaction log backups taken at the 6-hour intervals described above to be truncated because
if I do, it basically makes the transaction log useless in a restore where all the transaction log backups done in the previous 6-hour increments cannot be restored ‘in order’.
Any and all help and clarification will be much appreciated.


R. Brown

Creating SQL Jobs of Powershell type

$
0
0

Hi,

I am trying to create and execute a Job of a powershell type, but it fails to execute with below error.


The process could not be created for step 2 of job 0xA72711A1EE783E4F8DB5FF9DEB9BE78E (reason: A required privilege is not held by the client).  The step failed.

I have configured credentials and proxy to run the Job.

Anything I am missing??




Mysterious NDF file, can its contents be viewed?

$
0
0

I have just noticed a mysteriously named NDF file in a DB we're using.

The file is not in the regular storage location as the other ndf's or mdf's.

The name of the file is CDriveFile.ndf

This is not conforming with our file name standard.

Just wondering, can NDF's files be pried into to see what they contain? I'd like to remove this file but not sure if it has valid data or not. I have read somewhere that sometime SQL Server will sometimes spill data into other locations if data space is full, not sure if this file is that. Last time file was modified was 2014, but that doesn't necessarily mean that the data is bad or dead.

Any advice on this appreciated, thanks!

Database keeps going to Single User Mode

$
0
0

Hello Guru's, 

Two of our TEST database keeps going on to Single_User mode quite often every couple of days. 

Is there a way to find out which user is taking it to that state or what time has it gone to that state?

Best regards, 

Mohan

'Not enough storage available to process' message when importing file

$
0
0

From Paula Jennings  (@PjTrilobyte) via Twitter who tweets:

“ I am trying to load from excel to a basic level azure sql database using Microsoft SQL Server Management Studio, Import for a file that has 580k rows. I get a "not enough storage available to process". Can you help me understand if it is to do with memory on my local machine or too man records or some limit on a basic sql database or another reason?”

Customer was sent the documentation on https://blogs.technet.microsoft.com/abizerh/2009/07/12/troubleshooting-the-error-not-enough-storage-is-available-to-complete-this-operation/

Tweet URL: https://twitter.com/PjTrilobyte/status/720603938274148353

Appreciate if you may be able to advise the customer further on this matter or confirm if there may be a workaround for using a smaller file of 199999 lines and then merging the files.
 
Thanks,
@AzureSupport


partition switch does not switch data to the target partition

$
0
0

Hello,

I'm try to switch partition between two partitioned tables the switch statement works and there are no errors and the data does not switch. Can anyone help with steps to troubleshoot this situation?

My scenario is something similar to the T-SQL statements below:

CREATE TABLE [dbo].[TablePartitionSource](
 [ID] [nvarchar](50) NULL,
 [word] [varchar](40) NOT NULL,
 [ProcessingDate] [datetime] NOT NULL
)  ON [ps_DailySnapshot] ([ProcessingDate])

CREATE TABLE [dbo].[TablePartitionDestination](
 [ID] [nvarchar](50) NULL,
 [word] [varchar](40) NOT NULL,
 [ProcessingDate] [datetime] NOT NULL
)  ON [ps_DailySnapshot] ([ProcessingDate])

Insert INTO [dbo].[TablePartitionSource]  VALUES ((1,'Tom','2016-03-25'),(1,'Dean','2016-03-25'),(1,'Harry','2016-03-25'))

ALTER TABLE TablePartitionSource SWITCH PARTITION  $partition.pf_DailySnapshot('2016-03-25') TO TablePartitionDestination PARTITION $partition.pf_DailySnapshot('2016-03-25');

The above switch statement executes successfully but the data won't switch to the empty partition. Does anyone know why>

Thanks 

Max worker threads for Sharepoint

$
0
0
Hi there, I need some advise on running out of threads on the Sharepoint server. We have previously added CPU to assist, but we are back in the same boat again 6 months later and are waiting for new hardware. Currenlty the MAX_Threads = 576 of which SQL max out as 743 sometimes with -167 Available Threads. I also see CPU contention with Tasks Waiting on CPU. So, the question is ... is there a rule to follow when upping 'max worker threads' in SQL Server 2012 or can I change it from 0 to say 750 ?

CPU usage of SQL server is 100%

$
0
0

Dear team,

We have observed since last week, the CPU usage of SQL server became 100%. We are using SQL server 2008 r2 standard as a backend of SharePoint 2010 application server.

Due to this, The SharePoint list are not able to load all items in the lists. We want to reduce the CPU usage of SQL server as well as we want that SharePoint application can able to load all the list items in all lists.

Please help and guide, you can send me an email on mitesh.patel@pratham.com or my mobile number is +919687684006.

We are not able to generate support ticket on Microsoft as well as When we are calling on the number 1800 419 5666, the call is not being established due to our inputs are not being taken.

Regards,

Mitesh Patel

+919687684006

We are getting warning of event id of 54 on frequently basis.

$
0
0
The description for Event ID ( 54 ) in Source ( Tcpip ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: \Device\Tcp.

Error "the type initializer for 'AsyncWMIBinding' threw an exception, unable to load DLL 'sqltoolsnativehelpers.dll'

$
0
0

Hi,

I just performed a clean install of SQL 2012 on Server 2012R2. When I try to start Management Studio I get the error:

Error connecting to SQLSERVERname

The type initializer for 'AsyncWMIBinding' threw an exception (object explorer)

--->Unable to load DLL 'sqltoolsnativehelpers.dll': This program is blocked by Group Policy. For more information, contact your system administrator. (exception from HResult: 0x800704EC), (object explorer).

I am just looking to load a basic SQL installation here. Currently this machine is on the domain and in a GPO blocked OU.

Updates are disabled.

Any idea's? Can't find much on this.

Import-Module 'sqlps' -DisableNameChecking is returning a bunch of warnings I do not want to see in output. How do I supress them?

$
0
0

Hi All,

I find that with SQL 2012 and SQL 2014 I get the following types of WARNING: messages displayed when I import the sqlps module.

WARNING: The local computer does not have an active instance of Analysis Services.
WARNING: Could not obtain SQL Server Service information. An attempt to connect to WMI on 'Microsoft.WindowsAzure.Commands.SqlDatabase.Types.ps1xml' failed with the following error: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

I've tried adding -WarningAction SilentlyContinue and I've tried piping the output to null by adding | Out-Null but I still get this garbage that I don't care about on the servers I'm running these scripts on.  Do any of you know how to suppress these warnings?

Joe


Joe Moyle

PowerShell - restore with Norecovery

$
0
0

Hi, I'm trying to restore all backups from a folder. it worked fine but I need to restore with NORECOVERY, Please review my command and give me a solution for this.

Restore-SqlDatabase -ServerInstance $server -Database $databaseName -BackupFile $backupFile.FullName -RelocateFile @($RelocateData,$RelocateLog) -ReplaceDatabase


Looking for third party tool for SQL Script deployment

$
0
0

We are doing some DAR on tools to do SQL script deployment efficiently and with core features required  like auto rollback, audit logging ,etc.

We have used DB up library but it requires lot of custom coding so please suggest any third party tool which can help to manage script deployment more efficiently without any manual efforts.

Appreciated your help , Have a nice day ..

-KM


.*´¨) ¸.·´¸.·´¨) ¸.·*¨) (¸.·´ (¸.·´ .·´ (´¸.·* *·.¸.´¯`> Krunal

Unable to Remove Filestream Filegroup and Associated Database File

$
0
0

Hi folks,


I had 5 FileTables which I have since converted to regular tables with varbinary(max) columns instead, migrated all the data from the filetables to the new tables and dropped the filetables completely. I ran the sp_filestream_force_garbage_collection process and dbcc ShrinkFile (file_stream_name, EmptyFile) for the filestream, the filestream and file associated is currently showing 0 mb in size, however I still cannot remove the files associated with the filestream.


The error message I receive is: "The file 'file_stream_name' cannot be removed because it is not empty." when I attempt to drop the filestream's filegroup and/or the file associated with the filegroup. The filesize currently shows 0 MB in size, however it still complains about it not being empty.


I'm using Microsoft SQL Server 2012 Standard Edition, however the error happens on Enterprise Edition also.

Any help would be greatly appreciated.

Kind regards,

Michael Murray

How upgrading into Windows 10 will effect my existing SQL Server of windows 8.1?

$
0
0
Hi, i am using windows 8.1 pro in my PC. several months ago windows has recommended me to upgrade to windows 10. In my windows 8.1 i am using Visual Studio 2012, Microsoft SQL server 2008 and many other developing tools and database engines. So if i upgrade to windows 10, using the 'Get Windows 10' app which is on the taskbar, what will happen to my database engines? will all the databases, settings be gone? Because it took me a great effort to develop some app in the visual studio using those databases of the Microsoft SQL Server. So i want some advice regarding this matter. :)

SQL 2012 AG - Flush Logs and Shrink Log File

$
0
0

I am trying to shrink a log file for a sql 2012 always on availability group. is this not possible? i see the log file has empty space inside, but when i run the shrink command it completes and nothing happens. 

I have 4 nodes, 2 sync and 2 async. 

thanks

Gd

Agent Job SSIS Package Step fails with error 1059 when writing output logfile

$
0
0

Hi,

on one of our production servers, we have an SQL Agent Job with one step, an SSIS Package execution step. This SSIS package is executed under a proxy account (a useraccount in a domain), because it accesses the file system. This all used to work quite well and reliably, but in the last two days, the job failed with the error:

Executed as user: domain\user. Warning: cannot write logfile D:\Log\JobLog.txt. Error 1059 : Circular service dependency was specified.  The step failed.

The logfile is specified in the Advanced tab of the step under "Output file". When I remove the file name, thus deactivating the SSIS engine logging, the job runs successfully.

I'm wondering why this suddenly fails and why writing to an output file would cause a circular service reference...

Has anyone else seen this before?

Thanks,

Roland

Viewing all 1519 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>