Showing posts with label SQL Server 2008. Show all posts
Showing posts with label SQL Server 2008. Show all posts

Sunday, October 5, 2014

How to Shrink WSS_Logging Database?

Issue:
SharePoint 2010/2013 always fill the "WSS_Logging.mdf" file continuously. If you are trying to shrink or empty the ".mdf" or ".ldf" files, you will not be able to shrink them.

Follow the below steps to shrink them immediately.

Solution:
1. Open a new Query window by right clicking the "WSS_Logging" database.
2. Paste the below query and execute it which will empty the unwanted contents from database.

DECLARE @TableName AS VARCHAR(MAX)
DECLARE table_cursor CURSOR
FOR 
SELECT TABLE_NAME 
FROM INFORMATION_SCHEMA.TABLES 
WHERE TABLE_TYPE = 'BASE TABLE'
AND TABLE_NAME LIKE '%_Partition%'
OPEN table_cursor
FETCH NEXT FROM table_cursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @SQLText AS NVARCHAR(4000)

SET @SQLText = 'TRUNCATE TABLE ' + @TableName

EXEC sp_executeSQL @SQLText

FETCH NEXT FROM table_cursor INTO @TableName 
END
CLOSE table_cursor
DEALLOCATE table_cursor


3. Once the above is query executed, your SQL DB is ready to shrink. (If the above query is not executed, then you will not be able to shrink the "WSS_Content.mdf" file.

4. Now right click on the database and go to the "shrink window" as mentioned below and shrink the DB to "50 MB".

























5. Now the DB size would be re-sized to 50 MB.

Thats it...

Monday, October 14, 2013

Procedure or function proc_SecGetIndividualUrlSecurityCheckEventReceivers expects parameter @MinLevel, which was not supplied.

Issues:

Unknown SQL Exception 201 occurred. Additional error information from SQL Server is included below.


Procedure or function 'proc_SecGetIndividualUrlSecurityCheckEventReceivers' expects parameter '@MinLevel', which was not supplied.











(Or)

Unable to delete the File or Folder or Library or List from SharePoint 2010 portal.

(Or)

Unknown SQL Exception 208 occurred. Additional error information from SQL Server is included below.

Invalid object name 'TVF_Sites_NoLock_Id'.

(Or)

Unknown SQL Exception 208 occurred. Additional error information from SQL Server is included below.

Invalid object name 'TVF_Docs_NoLock_Url'.
Invalid object name 'TVF_Docs_Url'.














(Or)

Unknown SQL Exception 208 occurred. Additional error information from SQL Server is included below.

Invalid object name 'TVF_EventCache_UpdLock_GTId'.
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.

Reason:
The reason for these errors are you might have attached the SharePoint content database in the destination SQL Server and may trying to create a Web application based on this restored database.

(Or)

You might have updated / changed the "Versions" table value in SharePoint Content Database after restoring the destination SQL Server.

Solution:
You need to update or install the Latest SharePoint Server 2010 Cumulative Update (CU). In most of the cases, the installation of "SharePoint 2010 Oct 2011 CU" will solve the problem.

But make sure that you have restarted your server twice to take effect the fix.

Related Link: http://sensoft2000-sharepoint.blogspot.in/2013/09/this-content-database-has-schema.html


Tuesday, April 3, 2012

How to: Shrink the SQL Server 2008 Log file (Even though in Mirroring)

How to: Shrink the SQL Server 2008 Log file Even though the database is in Mirroring


Sometimes you will not be able to shrink the SharePoint database log files, if the SQL Server 2008 database is in Mirroring option.


Solution:
At that time you need to open the "SQL Server management studio" and run the below query.



USE [WSS_Content_DBName]
Go
BACKUP LOG [WSS_Content_DBName] TO DISK='NULL'
Go
DBCC shrinkfile ('WSS_Content_LogName', 1) 
Go


Update:
If the above lines are not working, just try again the same query. Because sometimes it will take few more seconds to shrink the log files.