Showing posts with label attaching. Show all posts
Showing posts with label attaching. Show all posts

Friday, February 17, 2012

Create Database With Attach in Restricted_user mode?

Try attaching the db and then use "alter database" and set the option
"RESTRICTED_USER".
AMB
"RBarryYoung@.gmail.com" wrote:

> How can I attach a database and keep it in Restricted_User mode? I
> cannot find a way to do this in BOL.
> -- RBarryYoung
>How can I attach a database and keep it in Restricted_User mode? I
cannot find a way to do this in BOL.
-- RBarryYoung|||Try attaching the db and then use "alter database" and set the option
"RESTRICTED_USER".
AMB
"RBarryYoung@.gmail.com" wrote:

> How can I attach a database and keep it in Restricted_User mode? I
> cannot find a way to do this in BOL.
> -- RBarryYoung
>|||No, this leaves a window of oppurtunity between the attach and the
"Alter Database". I need to "keep it" in Restricted mode, as it was
when I detached it, similar to the RESTRICTED_USER/DBO_ONLY keywords
for RETORE operations.
It is not supposed to be accessible by anyone until I am done making
the necessary changes to it.
Alejandro Mesa wrote:[vbcol=seagreen]
> Try attaching the db and then use "alter database" and set the option
> "RESTRICTED_USER".
>
> AMB
>
> "RBarryYoung@.gmail.com" wrote:
>|||No, this leaves a window of oppurtunity between the attach and the
"Alter Database". I need to "keep it" in Restricted mode, as it was
when I detached it, similar to the RESTRICTED_USER/DBO_ONLY keywords
for RETORE operations.
It is not supposed to be accessible by anyone until I am done making
the necessary changes to it.
Alejandro Mesa wrote:[vbcol=seagreen]
> Try attaching the db and then use "alter database" and set the option
> "RESTRICTED_USER".
>
> AMB
>
> "RBarryYoung@.gmail.com" wrote:
>|||<RBarryYoung@.gmail.com> wrote in message
news:1150144741.478126.196290@.f6g2000cwb.googlegroups.com...
> No, this leaves a window of oppurtunity between the attach and the
> "Alter Database". I need to "keep it" in Restricted mode, as it was
> when I detached it, similar to the RESTRICTED_USER/DBO_ONLY keywords
> for RETORE operations.
> It is not supposed to be accessible by anyone until I am done making
> the necessary changes to it.
Haven't tried this, but wrap the whole thing in a transaction?

> Alejandro Mesa wrote:
>|||<RBarryYoung@.gmail.com> wrote in message
news:1150144741.478126.196290@.f6g2000cwb.googlegroups.com...
> No, this leaves a window of oppurtunity between the attach and the
> "Alter Database". I need to "keep it" in Restricted mode, as it was
> when I detached it, similar to the RESTRICTED_USER/DBO_ONLY keywords
> for RETORE operations.
> It is not supposed to be accessible by anyone until I am done making
> the necessary changes to it.
Haven't tried this, but wrap the whole thing in a transaction?

> Alejandro Mesa wrote:
>

Tuesday, February 14, 2012

Create database in SQL Server 2005 and Attaching it in SQL Express

Hi,

I've created a database in sql server 2005, but now I need to detach this database and attach it in sql express. Is this possible? I keep getting an error that my database is readonly. Any help would be greatly appreciated.

thanks in advance.

Yes, it is possible.

Sometimes, when the database file is detached, the OS changes the file permissions.

Using Windows Explorer, check the file properties, and remove the Read Only checkmark if one is present. Then re-attach.

|||

or you can use Backup/Restore method. Restore the database with MOVe option. Check Restore syntax in BOL

Madhu