Showing posts with label SQL DBA. Show all posts
Showing posts with label SQL DBA. Show all posts

Sunday, June 14, 2015

NetFx3 error while installing SQL Server 2012 on windows 2012 server



Problem description

TITLE: Microsoft SQL Server 2012 Service Pack 1 Setup

The following error has occurred:

Error while enabling Windows feature : NetFx3, Error Code : -2146498298 , Please try enabling Windows feature : NetFx3 from Windows management tools and then run setup again. For more information on how to enable Windows features , see http://go.microsoft.com/fwlink/?linkid=227143







Solution 

Goto server manager
 --> Click on manager right side corner of window
--> Click Add Roles and Features



Blow Add Roles and features wizard window appears 


click on next


in the next screen click on Role-based or feature-based installation

and click on the next


in the Server Selection Screen select the first radio button i.e. Select a Server from the Server Pool 

In the server pool window you can see the server name 


On Server Roles page simply click on next

in Features page wizard clicked on the check box next to ".NET Framework 3.5 Features", and then clicked on the Next as shown in below image


and in final wizard click on install to add features



and installation progress as below 





Thanks & Regards
Venkat Sangu

Thursday, May 21, 2015

Install SQL Server 2012 in Stand Alone Machine


Requirements for Installing SQL Server 2012:

1.       Operating system Requirement :
You can install in below operating systems
Windows Server 2012,
Windows 8,
Windows server 2008 R2 SP1,
Windows 7 SP1.
You can also install in below operating systems but you require to install update http://support2.microsoft.com/?kbid=956250 on below operating system before initiating the installation.
Windows Vista SP2
Windows Server 2008 SP2
2.       NET Framework
.NET 4.0 is a requirement for SQL Server 2012. SQL Server installs .NET 4.0 during the feature installation step.
You must enable or install.NET 3.5 SP1, If you select to install Database Engine, Reporting Services, Master Data Services, Data Quality Services, Replication, SQL Server Management Studio on Windows Vista SP2 or Windows Server 2008 SP2 operating systems. OS wont have .NET 3.5 SP1 Framework 
3.       Windows Powershell
Powershell 2.0 is mandatory to install SQL Server 2012. If  SQL Server setup reports Powershell 2.0 is not present, you can install or enable it.
4.       Internet Explorer 7 or a later version.
5.       Hard Disk : SQL Server 2012 requires minimum of 6 GB.
6.       Memory
 Minimum :  
<![if !supportLists]>1.       <![endif]>Express : 512 MB
<![if !supportLists]>2.       <![endif]>Other  : 1 GB
       Recommended
<![if !supportLists]>                                                         i.            <![endif]>Express : 1 GB
<![if !supportLists]>                                                       ii.            <![endif]>Other  : 4 GB


Installation Steps:
Go to setup file location  click on setup.exe



Next you will see the SQL Server Installation Center  page. In Left side pane select Installation Tab


In installation page, right side pane you will found 4 option 
               
Option 1 : New SQL Server stand-alone installation or add features to existing installation 
                                Using this option you can install Stand-alone server  or add SQL Server features to an existing installation
Option 2 : New SQL Server failover cluster installation
                                Using this option you can install a SQL Server in Failover Cluster
Option 3 : Add Node to the SQL Server failover cluster
                                This option is used to add a node to an existing failover cluster
Option 4 : Upgrade from SQL Server 2005, SQL Server 2008 or SQL Server 2008 R2
                                Using this option we can upgrade the existing SQL Server 2005, SQL Server 2008, or SQL Server 2008 R2 to SQL Server 2012

Now we are performing SQL Server stand-alone installation so click on Option 1.




It will initiate the stand-alone installation process of SQL Server 2012

                               

Next screen displays you Setup Support Rules screen, click on  button to see all the rules information.

Click on Ok


Above screen will provide you the available latest updates.


Click on the Next.


In next screen you need to select weather is it new installation are adding features to an existing installed instance.

Select Perform a new installation of SQL Server 2012 radio button for fresh installation


In next screen need to select weather is it free edition or need to provide product key and click on Next


Next  is the license  terms screen. You need to accept the license terms and click on Next.

l

Select All features with defaults to install all features with default values and select Next


Select the what ever you want install in the instances. If this is the first installation you can select what ever shared features you want. If it is another instance already installed shared features are grayed out. Click on Next


























Difference between DateTime and DateTime2 DataType

DATETIME2 is the new data type introduced in SQL Server 2008

DATETIME2 provides more seconds precision & has larger date range, a larger default fractional precision. DATETIME is limited to 3 1/3 milliseconds, while DATETIME2 can be accurate down to 100ns

Advantages of DATETIME2
DATETIME2 has a date range of "0001 / 01 / 01" through "9999 / 12 / 31" while the DATETIME type only supports year 1753-9999
Larger range of values
Better Accuracy
Smaller storage space (if optional user-specified precision is specified)

Precision, scale
                                                                                                        0 to 7 digits, with an accuracy of 100nanoseconds.
                                                                                                        The default precision is 7 digits.
Storage Size
                                                                                                        6 bytes for precision less than 3
                                                                                                        7 bytes for precision 3 and 4.
All other precision require 8 bytes.
DATETIME2 with fractional seconds precision of 3 is same as DATETIME data type. And DATETIME2 (precision of 3) uses 7 bytes of storage instead of 8 byte

If you only need the date without time part use DATE
 If you only need the time without date part use TIME
 Using DATE & TIME data types instead of DATETIME2 in above situations you save the space

SQL Server Job history


Using below script you can fetch the specific job history like executing date and durations



select job_name, run_datetime, run_duration
from
(
    select job_name, run_datetime,
        SUBSTRING(run_duration, 1, 2) + ':' + SUBSTRING(run_duration, 3, 2) + ':' +
        SUBSTRING(run_duration, 5, 2) AS run_duration
    from
    (
        select DISTINCT
            j.name as job_name, 
            run_datetime = CONVERT(DATETIME, RTRIM(run_date)) +  
                (run_time * 9 + run_time % 10000 * 6 + run_time % 100 * 10) / 216e4,
            run_duration = RIGHT('000000' + CONVERT(varchar(6), run_duration), 6)
        from msdb..sysjobhistory h
        inner join msdb..sysjobs j
        on h.job_id = j.job_id
    ) t
) t
where job_name = 'Job name '
order by job_name, run_datetime

--- Query results are like below


SQL Script to Change the database to read only and read write


Below script is used to change the database into single user mode. To kill the current connections change the database to single user mode then change it to single user mode.Replace the database name from MyDATABASE to the database name need to change to READ ONLY

USE [master]
GO
ALTER DATABASE [MyDATABASE]  SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
 ALTER DATABASE [MyDATABASE] SET READ_ONLY WITH NO_WAIT
GO
ALTER DATABASE [MyDATABASE] SET MULTI_USER
GO

Below script is used to change the database into read/write user mode.

 ALTER DATABASE [MyDATABASE] SET READ_WRITE WITH NO_WAIT

Rename the sql server database


There are couple of options are available to rename the database.
Option 1 :
 Rename the "MyDATABASE" to "MyDATABASE_NEW" using sp_renamedb command

 EXEC sp_renamedb 'MyDATABASE', 'MyDATABASE_NEW' 

Option 2:
 Rename the "MyDATABASE" to "MyDATABASE_NEW" using ALTER DATABASE Commnad

USE [master]
GO

ALTER DATABASE [MyDATABASE] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE [MyDATABASE] MODIFY NAME = MyDATABASE_NEW
GO
ALTER DATABASE [MyDATABASE_NEW] SET MULTI_USER
GO

SQL Server installation methods


There are three types of Installation methods 
1. Local/Standard installation
2. Unattended installation 
3. Remote Installation 

Local/Standard installation
To perform standard installation you need to login into the machine and the login is part of local administrator group. 

Unattended installation 
It is also known as silent installation. Install multiple SQL Servers with identical configurations without using the interactive SQL Server setup is known as Unattended installation. 
Installation initiates from command prompt ( batch file will call setup file).
All the parameters are saved in configuration file (setup.exe) 

An unattended installation using a configuration file using the following command line at a new command prompt.
D:\SQLFULL_x86_ENU\Setup.exe /ConfigurationFile=D:\SQLFULL_x86_ENU\SQLConfigurationFile.ini

 

Remote Installation
You can install SQL Server from remote machine also. 
To perform remote installation the user account should have following permissions 
1. Have administrative rights on the remote computer. 
2. Have read access to the setup source files folder.


Error messages when restoring from different versions of SQL Server.

We can't restore the backups taken in Newer version of SQL Server instance on older version of SQL Server. 

SQL Server 2008 R2 to SQL Server 2008
Msg 3169, Level 16, State 1, Line 1
The database was backed up on a server running version 10.50.1600. That version is incompatible with this server, which is running version 10.00.1600. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.


SQL Server 2008 R2 to SQL Server 2005
Server: Msg 3241, Level 16, State 7, Line 1
The media family on device 'f:\temp\test001_sql2008r2.bak' is incorrectly formed. SQL Server cannot process this media family.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.



SQL Server 2008 R2 to SQL Server 2000
Server: Msg 3169, Level 16, State 1, Line 1
The backed-up database has on-disk structure version 661. The server supports version 539 and cannot restore or upgrade this database.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.


SQL Server 2008 to SQL Server 2005
Server: Msg 3241, Level 16, State 7, Line 1
The media family on device 'f:\temp\test001_sql2008.bak' is incorrectly formed. SQL Server cannot process this media family.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.



SQL Server 2008 to SQL Server 2000
Server: Msg 3169, Level 16, State 1, Line 1
The backed-up database has on-disk structure version 655. The server supports version 539 and cannot restore or upgrade this database.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.



SQL Server 2005 to SQL Server 2000
Server: Msg 3169, Level 16, State 1, Line 1
The backed-up database has on-disk structure version 611. The server supports version 539 and cannot restore or upgrade this database.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.





TDSSNIClient initialization failed with error 0x80092004, status code 0x1. Reason: Initialization failed with an infrastructure error. Check for previous errors. Cannot find object or property.


2015-02-17 12:27:38.19 spid15s     Error: 26014, Severity: 16, State: 1.
2015-02-17 12:27:38.19 spid15s     Unable to load user-specified certificate [Cert Hash(sha1) "5B4FF9FFF4E6752A3AD51489E1A9C455E580BCC3"]. The server will not accept a connection. You should verify that the certificate is correctly installed. See "Configuring Certificate for Use by SSL" in Books Online.
2015-02-17 12:27:38.19 spid15s     Error: 17182, Severity: 16, State: 1.
2015-02-17 12:27:38.19 spid15s     TDSSNIClient initialization failed with error 0x80092004, status code 0x80. Reason: Unable to initialize SSL support. Cannot find object or property. 
2015-02-17 12:27:38.19 spid15s     Error: 17182, Severity: 16, State: 1.
2015-02-17 12:27:38.19 spid15s     TDSSNIClient initialization failed with error 0x80092004, status code 0x1. Reason: Initialization failed with an infrastructure error. Check for previous errors. Cannot find object or property. 
2015-02-17 12:27:38.19 spid15s     Error: 17826, Severity: 18, State: 3.
2015-02-17 12:27:38.19 spid15s     Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.
2015-02-17 12:27:38.19 spid15s     Error: 17120, Severity: 16, State: 1.
2015-02-17 12:27:38.19 spid15s     SQL Server could not spawn FRunCommunicationsManager thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.
Event ID 17182: TDSSNIClient initialization failed with error 0x7e, status code 0x3a.

Event ID 17826: Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.

Event ID 17120: SQL Server could not spawn FRunCM thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.

Solution :

1. Check 'Forced Encryption' (Turned False) and 'Certificate' value is cleared under SQL Server Configuration Manager.
2> Check the following registry key 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQL2008\MSSQLServer\SuperSocketNetLib\Certificate
and clear the Certificate values.





Friday, May 1, 2015

Installing SQL Server – reboot required check fails


Not able to install SqlServer 2008 says Restart computer failed

SQL Server Installation Rules and "System Reboot Required" Error

I get the error message the prerequisites  "Restart the computer is required".


When installing SQL Server some times you may run to situation for "Reboot required check failed" failed issue in prerequisites validation screen.  To skip this failure without restarting machine. 

Goto run and type regedit.exe to open registry 


in registry 


Goto:  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager , and instead of "EXPANDING" Session Manager, "SELECT" it and you will see the entry called, PENDING FILE RENAME OPERATION 








Take backup of registry value first.

Then, If PENDING FILE RENAME OPERATION has any values just remove it and clear the value

Reboot the System and again go to PENDING FILE RENAME OPERATION and see if there is any values still available.


--
Thanks & Regards
Venkat Sangu

Thursday, April 30, 2015

CREATE LOGIN of windows user and GRANT SYSADMIN Access

Using below command you can create a windows login and grant SysAdmin access. Replace DOMAIN\LOGIN with windows login name 


USE [master]
GO
CREATE LOGIN [DOMAIN\LOGIN] FROM WINDOWS WITH DEFAULT_DATABASE=[master]
GO
EXEC master..sp_addsrvrolemember @loginame = N'DOMAIN\LOGIN', @rolename = N'sysadmin'
GO

--
Thanks & Regards
Venkat Sangu

Cannot access the specified path or file on the server. Verify that you have the necessary security privileges and that the path or file exists

If you received below error while attaching a .mdf file in cluster environment please follow below steps to resolve the issue ERROR Ca...