Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Wednesday, March 28, 2012

Restrict ASP.NET app DB permissions using Integrated Security

How might I Restrict ASP.NET app DB permissions using Integrated Security?

I can see how it's done with SQL Authentication, but I'd prefer to do it with Windows Authentication.

Is it a matter of restricting the permissions of the general ASP.NET user (“NT AUTHORITY\NETWORK SERVICE”)...seems like it might affect too much.

Or can I have a Windows user/identity/account that is specific to a single ASP.NET Application?

Any guidance on this would be appreciated.

Thanks!

You can assign a specific domain account to the application.

Check out using an 'Application Pool' for Web Security.

|||Bingo. Thanks!

Restoring using smo

I have built a VB.NET app that uses SMO to restore a database from a backup device to a database. This works great if I restore the backup into the original database. If, however, i try to restore the backup into ANOTHER database, it fails. My code looks like this (only important parts are included):

db1 = New Management.Smo.Database

db1.Name = Me.lstDatabase.SelectedItem

restore = New Management.Smo.Restore

restore.Action = Management.Smo.RestoreActionType.Database

restore.Database = db1.Name

backDeviceItem = New Management.Smo.BackupDeviceItem(Me.lstBackups.Text, Management.Smo.DeviceType.LogicalDevice)

restore.Devices.Add(backDeviceItem)

restore.ReplaceDatabase = True

restore.SqlRestore(SqlServerSelection)

In this example, the lstBackups contains the list of backup devices. lstDatabase contains the list of databases to restore into. I can successfully connect to the database, but the restore fails. Any ideas?

Thanks...

Scott

What privilege level is the user attempting to do the restore? While a db_owner user can back up a database, the restore is in essence a create database process, which requires sysadmin level privileges.|||Also the database has to be in restricted mode.

db1.DatabaseOptions.UserAccess = DatabseUserAccess.Restrictedsql

Restoring using smo

I have built a VB.NET app that uses SMO to restore a database from a backup device to a database. This works great if I restore the backup into the original database. If, however, i try to restore the backup into ANOTHER database, it fails. My code looks like this (only important parts are included):

db1 = New Management.Smo.Database

db1.Name = Me.lstDatabase.SelectedItem

restore = New Management.Smo.Restore

restore.Action = Management.Smo.RestoreActionType.Database

restore.Database = db1.Name

backDeviceItem = New Management.Smo.BackupDeviceItem(Me.lstBackups.Text, Management.Smo.DeviceType.LogicalDevice)

restore.Devices.Add(backDeviceItem)

restore.ReplaceDatabase = True

restore.SqlRestore(SqlServerSelection)

In this example, the lstBackups contains the list of backup devices. lstDatabase contains the list of databases to restore into. I can successfully connect to the database, but the restore fails. Any ideas?

Thanks...

Scott

What privilege level is the user attempting to do the restore? While a db_owner user can back up a database, the restore is in essence a create database process, which requires sysadmin level privileges.|||Also the database has to be in restricted mode.

db1.DatabaseOptions.UserAccess = DatabseUserAccess.Restricted

Tuesday, March 20, 2012

Restoring MSDE databases to SQL Server 2000

Hi,
We have a MSDE 2000 installed on a blackberry server that contains
Blackberry configuration data. For testing the Net backups we need to restor
e
it to a SQL Server 2000 server. The SQL Server 2000 is already installed and
has couple of test databases that I will drop before doing the restore for
the system and the user databases from the Net backups of the MSDE 2000
databases.
I am planning on restoring master first, then msdb, then model and then the
user databases. For restoring master I'll just restore the master from the
Net backup so that it replaces the current master and then I will just repea
t
the process with other system databases. Is this the right way to proceed or
am I missing something? Any advise will be greatly appreciated. Thanks.If you don't have the same path, then you will get into some problems. Also
make sure you have the
same build number of the SQL Server engines. And, finally, read KB 224071
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:5DDC3553-2145-4212-9EBE-69EAF201633A@.microsoft.com...
> Hi,
> We have a MSDE 2000 installed on a blackberry server that contains
> blackberry configuration data. For testing the Net backups we need to rest
ore
> it to a SQL Server 2000 server. The SQL Server 2000 is already installed a
nd
> has couple of test databases that I will drop before doing the restore for
> the system and the user databases from the Net backups of the MSDE 2000
> databases.
> I am planning on restoring master first, then msdb, then model and then th
e
> user databases. For restoring master I'll just restore the master from the
> Net backup so that it replaces the current master and then I will just rep
eat
> the process with other system databases. Is this the right way to proceed
or
> am I missing something? Any advise will be greatly appreciated. Thanks.|||Thanks a lot. I did check the paths and found that the paths were different.
So I created the same path on the target server. I found this on the SQL
Server properties 8.00.760 (SP3) on both the SQL Servers. Is this what you
are referring to as the build numbers?
The article that you have mentioned KB 224071 diccusses moving databases by
detaching and attaching, while I want to restore using the files from the
VERITAS Net Backup to test it. Any insight would be appreciated.
"Tibor Karaszi" wrote:

> If you don't have the same path, then you will get into some problems. Als
o make sure you have the
> same build number of the SQL Server engines. And, finally, read KB 224071
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "sharman" <sharman@.discussions.microsoft.com> wrote in message
> news:5DDC3553-2145-4212-9EBE-69EAF201633A@.microsoft.com...
>
>|||> I found this on the SQL
> Server properties 8.00.760 (SP3) on both the SQL Servers. Is this what you
> are referring to as the build numbers?
Yes.

> while I want to restore using the files from the
> VERITAS Net Backup to test it. Any insight would be appreciated.
Which, I believe, lead you in to unsupported territory. Anyhow, check out
http://vyaskn.tripod.com/moving_sql_server.htm
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:20CAF583-3917-4396-89E3-ED54C7BD3087@.microsoft.com...[vbcol=seagreen]
> Thanks a lot. I did check the paths and found that the paths were differen
t.
> So I created the same path on the target server. I found this on the SQL
> Server properties 8.00.760 (SP3) on both the SQL Servers. Is this what you
> are referring to as the build numbers?
> The article that you have mentioned KB 224071 diccusses moving databases b
y
> detaching and attaching, while I want to restore using the files from the
> VERITAS Net Backup to test it. Any insight would be appreciated.
> "Tibor Karaszi" wrote:
>

Restoring MSDE databases to SQL Server 2000

Hi,
We have a MSDE 2000 installed on a Blackberry server that contains
Blackberry configuration data. For testing the Net backups we need to restore
it to a SQL Server 2000 server. The SQL Server 2000 is already installed and
has couple of test databases that I will drop before doing the restore for
the system and the user databases from the Net backups of the MSDE 2000
databases.
I am planning on restoring master first, then msdb, then model and then the
user databases. For restoring master I'll just restore the master from the
Net backup so that it replaces the current master and then I will just repeat
the process with other system databases. Is this the right way to proceed or
am I missing something? Any advise will be greatly appreciated. Thanks.
If you don't have the same path, then you will get into some problems. Also make sure you have the
same build number of the SQL Server engines. And, finally, read KB 224071
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:5DDC3553-2145-4212-9EBE-69EAF201633A@.microsoft.com...
> Hi,
> We have a MSDE 2000 installed on a Blackberry server that contains
> Blackberry configuration data. For testing the Net backups we need to restore
> it to a SQL Server 2000 server. The SQL Server 2000 is already installed and
> has couple of test databases that I will drop before doing the restore for
> the system and the user databases from the Net backups of the MSDE 2000
> databases.
> I am planning on restoring master first, then msdb, then model and then the
> user databases. For restoring master I'll just restore the master from the
> Net backup so that it replaces the current master and then I will just repeat
> the process with other system databases. Is this the right way to proceed or
> am I missing something? Any advise will be greatly appreciated. Thanks.
|||Thanks a lot. I did check the paths and found that the paths were different.
So I created the same path on the target server. I found this on the SQL
Server properties 8.00.760 (SP3) on both the SQL Servers. Is this what you
are referring to as the build numbers?
The article that you have mentioned KB 224071 diccusses moving databases by
detaching and attaching, while I want to restore using the files from the
VERITAS Net Backup to test it. Any insight would be appreciated.
"Tibor Karaszi" wrote:

> If you don't have the same path, then you will get into some problems. Also make sure you have the
> same build number of the SQL Server engines. And, finally, read KB 224071
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "sharman" <sharman@.discussions.microsoft.com> wrote in message
> news:5DDC3553-2145-4212-9EBE-69EAF201633A@.microsoft.com...
>
>
|||> I found this on the SQL
> Server properties 8.00.760 (SP3) on both the SQL Servers. Is this what you
> are referring to as the build numbers?
Yes.

> while I want to restore using the files from the
> VERITAS Net Backup to test it. Any insight would be appreciated.
Which, I believe, lead you in to unsupported territory. Anyhow, check out
http://vyaskn.tripod.com/moving_sql_server.htm
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:20CAF583-3917-4396-89E3-ED54C7BD3087@.microsoft.com...[vbcol=seagreen]
> Thanks a lot. I did check the paths and found that the paths were different.
> So I created the same path on the target server. I found this on the SQL
> Server properties 8.00.760 (SP3) on both the SQL Servers. Is this what you
> are referring to as the build numbers?
> The article that you have mentioned KB 224071 diccusses moving databases by
> detaching and attaching, while I want to restore using the files from the
> VERITAS Net Backup to test it. Any insight would be appreciated.
> "Tibor Karaszi" wrote:

Restoring MSDE databases to SQL Server 2000

Hi,
We have a MSDE 2000 installed on a Blackberry server that contains
Blackberry configuration data. For testing the Net backups we need to restore
it to a SQL Server 2000 server. The SQL Server 2000 is already installed and
has couple of test databases that I will drop before doing the restore for
the system and the user databases from the Net backups of the MSDE 2000
databases.
I am planning on restoring master first, then msdb, then model and then the
user databases. For restoring master I'll just restore the master from the
Net backup so that it replaces the current master and then I will just repeat
the process with other system databases. Is this the right way to proceed or
am I missing something? Any advise will be greatly appreciated. Thanks.If you don't have the same path, then you will get into some problems. Also make sure you have the
same build number of the SQL Server engines. And, finally, read KB 224071
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:5DDC3553-2145-4212-9EBE-69EAF201633A@.microsoft.com...
> Hi,
> We have a MSDE 2000 installed on a Blackberry server that contains
> Blackberry configuration data. For testing the Net backups we need to restore
> it to a SQL Server 2000 server. The SQL Server 2000 is already installed and
> has couple of test databases that I will drop before doing the restore for
> the system and the user databases from the Net backups of the MSDE 2000
> databases.
> I am planning on restoring master first, then msdb, then model and then the
> user databases. For restoring master I'll just restore the master from the
> Net backup so that it replaces the current master and then I will just repeat
> the process with other system databases. Is this the right way to proceed or
> am I missing something? Any advise will be greatly appreciated. Thanks.|||Thanks a lot. I did check the paths and found that the paths were different.
So I created the same path on the target server. I found this on the SQL
Server properties 8.00.760 (SP3) on both the SQL Servers. Is this what you
are referring to as the build numbers?
The article that you have mentioned KB 224071 diccusses moving databases by
detaching and attaching, while I want to restore using the files from the
VERITAS Net Backup to test it. Any insight would be appreciated.
"Tibor Karaszi" wrote:
> If you don't have the same path, then you will get into some problems. Also make sure you have the
> same build number of the SQL Server engines. And, finally, read KB 224071
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "sharman" <sharman@.discussions.microsoft.com> wrote in message
> news:5DDC3553-2145-4212-9EBE-69EAF201633A@.microsoft.com...
> > Hi,
> >
> > We have a MSDE 2000 installed on a Blackberry server that contains
> > Blackberry configuration data. For testing the Net backups we need to restore
> > it to a SQL Server 2000 server. The SQL Server 2000 is already installed and
> > has couple of test databases that I will drop before doing the restore for
> > the system and the user databases from the Net backups of the MSDE 2000
> > databases.
> >
> > I am planning on restoring master first, then msdb, then model and then the
> > user databases. For restoring master I'll just restore the master from the
> > Net backup so that it replaces the current master and then I will just repeat
> > the process with other system databases. Is this the right way to proceed or
> > am I missing something? Any advise will be greatly appreciated. Thanks.
>
>|||> I found this on the SQL
> Server properties 8.00.760 (SP3) on both the SQL Servers. Is this what you
> are referring to as the build numbers?
Yes.
> while I want to restore using the files from the
> VERITAS Net Backup to test it. Any insight would be appreciated.
Which, I believe, lead you in to unsupported territory. Anyhow, check out
http://vyaskn.tripod.com/moving_sql_server.htm
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:20CAF583-3917-4396-89E3-ED54C7BD3087@.microsoft.com...
> Thanks a lot. I did check the paths and found that the paths were different.
> So I created the same path on the target server. I found this on the SQL
> Server properties 8.00.760 (SP3) on both the SQL Servers. Is this what you
> are referring to as the build numbers?
> The article that you have mentioned KB 224071 diccusses moving databases by
> detaching and attaching, while I want to restore using the files from the
> VERITAS Net Backup to test it. Any insight would be appreciated.
> "Tibor Karaszi" wrote:
>> If you don't have the same path, then you will get into some problems. Also make sure you have
>> the
>> same build number of the SQL Server engines. And, finally, read KB 224071
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> "sharman" <sharman@.discussions.microsoft.com> wrote in message
>> news:5DDC3553-2145-4212-9EBE-69EAF201633A@.microsoft.com...
>> > Hi,
>> >
>> > We have a MSDE 2000 installed on a Blackberry server that contains
>> > Blackberry configuration data. For testing the Net backups we need to restore
>> > it to a SQL Server 2000 server. The SQL Server 2000 is already installed and
>> > has couple of test databases that I will drop before doing the restore for
>> > the system and the user databases from the Net backups of the MSDE 2000
>> > databases.
>> >
>> > I am planning on restoring master first, then msdb, then model and then the
>> > user databases. For restoring master I'll just restore the master from the
>> > Net backup so that it replaces the current master and then I will just repeat
>> > the process with other system databases. Is this the right way to proceed or
>> > am I missing something? Any advise will be greatly appreciated. Thanks.
>>