Sunday, 2 December 2012

Read Write premission on database sql server


Making a SQL Server Database Read-Only
There are many situations where it is important that users are unable to modify the contents of a database. For example, if data is to be migrated to another server or for reporting purposes. This tip explains how to set a database to a read-only mode.
ALTER DATABASE Command
The ALTER DATABASE command allows a database administrator to modify SQL Server databases and their files and filegroups. This includes permitting the changing of database configuration options.
Setting a Database to Read-Only
When you need to ensure that the data is a database is not modified by any users or automated processes, it is useful to set the database into a read-only mode. Once read-only, the data can be read normally but any attempts to create, updated or delete table rows is disallowed. This makes the read-only mode ideal when preparing for data migration, performing data integrity checking or when the data is only required for historical reporting purposes.
To make a database read-only, the following command is used:
ALTER DATABASE database-name SET READ_ONLY
Setting a Database to Read-Write
If the read-only requirements for the database are temporary, you will need to reset the configuration option following any procedures undertaken. This is achieved with a small modification to the ALTER DATABASE statement to indicate that the database should return to a writeable mode.
ALTER DATABASE database-name SET READ_WRITE

ASP.NET IIS Registration Tool


1. The Issue

The MSDN documentation ( ASP.NET IIS Registration Tool ) states the following about installing .NET Framework 4 together with IIS 7.5:
The .NET Framework 4 can be installed side-by-side with previous versions of the .NET Framework on a single computer. If IIS was previously enabled on the computer, the setup process for the .NET Framework automatically registers ASP.NET 4 with IIS. However, if you install the .NET Framework 4 before you enable IIS, you must run the ASP.NET IIS Registration tool in order to register the .NET Framework with IIS and create application pools that use the .NET Framework 4.
What this means is that if you install .NET Framework 4 after installing IIS then everything gets registered properly. However, if you install .NET Framework 4 beforeinstalling IIS then you need to perform an extra step as outlined below.

2. The Solution

Run the following command from an administrative command prompt:
aspnet_regiis.exe -iru -enable
where:
-iru          Install this version of ASP.NET. If there are any existing applications that use ASP.NET, it will not change IIS configuration to use this version.
-enable          ASP.NET will be enabled in the IIS security console (IIS 6.0 or later).

3. Some Notes

  • You must ensure that the aspnet_regiis.exe file that is included in the .NET Framework 4 installation directory is used. The location of this file is as follows:
Version of .NET FrameworkLocation of Aspnet_regiis.exe file
.NET Framework version 4 (32-bit systems)%windir%\Microsoft.NET\Framework\v4.0.30319
.NET Framework version 4 (64-bit systems)%windir%\Microsoft.NET\Framework64\v4.0.30319
  • The 64-bit version should be used for Windows Server 2008 R2.
  • From the readme file:
ASP.NET 4 must be re-registered if IIS 7.5 or the IIS 7.5 .NET Extensibility feature is enabled *after* the .NET Framework 4 has already been installed on the computer. ASP.NET 4 must also be re-registered if the .NET Extensibility feature is removed when the .NET Framework 4 is installed on the computer.

4. Verification

The following diagram shows the default application pools within IIS 7.5 on Windows Server 2008 R2. In this case, .NET Framework 3.5 SP1 has been installed (supplied with the operating system). Note that this is registered as .NET Framework 2.0.
The next diagram shows the default application pools within IIS 7.5 on Windows Server 2008 R2 after .NET Framework 4 has been installed.

start sqlserver express


Go to: Control Panel -> Administrative Tools -> Services ->

right click on SQL Server (SQLEXPRESS) service then Properties -> Then Goto Logon tab -> Select the Local System Account option ->Apply->OK

Sql Express 2008 r2 download

http://www.microsoft.com/sqlserver/en/us/editions/express.aspx

download framework 4.0 for iis

http://www.microsoft.com/download/en/confirmation.aspx?id=17718

Tuesday, 27 November 2012

solve suspect database problem in sql server


EXEC sp_resetstatus 'yourDBname';
ALTER DATABASE yourDBname SET EMERGENCY
DBCC checkdb('yourDBname')
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('yourDBname', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname SET MULTI_USER

How to Restore SQL Server 2005 Suspect Database


EXEC sp_resetstatus 'yourDBname';
ALTER DATABASE yourDBname SET EMERGENCY
DBCC checkdb('yourDBname')
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('yourDBname', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname SET MULTI_USER