I receive a backup of a database, e.g. GImport. This backup is put on my
ftp-server and I need to restore the database on my databaseserver - the
GImport db is not currently on the server. Totally I need to perform the
following tasks:
1. Restore the database from the backup file. The name must be "GImport"
2. Move the restored files (db+log) to another location
3. Give the user myUsr read-access to all tables in the database
I have consulted BOL and I have made the following code
RESTORE FILELISTONLY
FROM DISK = 'c:\ftp\mp-back.dat'
RESTORE database GImport
FROM DISK = 'c:\ftp\mp-back.dat'
WITH NORECOVERY,
MOVE 'MP' TO 'D:\Data\mpgi.mdf',
MOVE 'MP_log' TO 'D:\Data\mpgi_log.ldf'
GO
It works fine ... kindda ... The database is created and the files are
moved to the correct location. But when I try to access the database via
Enterprise Mgr the database is "greyed out" and it says (Loading) besides
the name.
When running the code in QU I get the result:
Processed 132032 pages for database 'GImport', file 'MP' on file 1.
Processed 1 pages for database 'GeusImport', file 'MP_log' on file 1.
RESTORE DATABASE successfully processed 132033 pages in 46.329 seconds
(23.346 MB/sec).
... but the database remains grey and inaccessible
Do I need something else in my code above or is the problem caused by
something else?
Thanks,
:o)
Jesper Stocholm
http://stocholm.dk
Specify RECOVERY instead of NORECOVERY.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jesper Stocholm" <j@.stocholm.invalid> wrote in message
news:Xns96C5541FC45FAstocholmdk@.207.46.248.16...
>I receive a backup of a database, e.g. GImport. This backup is put on my
> ftp-server and I need to restore the database on my databaseserver - the
> GImport db is not currently on the server. Totally I need to perform the
> following tasks:
> 1. Restore the database from the backup file. The name must be "GImport"
> 2. Move the restored files (db+log) to another location
> 3. Give the user myUsr read-access to all tables in the database
> I have consulted BOL and I have made the following code
> RESTORE FILELISTONLY
> FROM DISK = 'c:\ftp\mp-back.dat'
> RESTORE database GImport
> FROM DISK = 'c:\ftp\mp-back.dat'
> WITH NORECOVERY,
> MOVE 'MP' TO 'D:\Data\mpgi.mdf',
> MOVE 'MP_log' TO 'D:\Data\mpgi_log.ldf'
> GO
> It works fine ... kindda ... The database is created and the files are
> moved to the correct location. But when I try to access the database via
> Enterprise Mgr the database is "greyed out" and it says (Loading) besides
> the name.
> When running the code in QU I get the result:
> Processed 132032 pages for database 'GImport', file 'MP' on file 1.
> Processed 1 pages for database 'GeusImport', file 'MP_log' on file 1.
> RESTORE DATABASE successfully processed 132033 pages in 46.329 seconds
> (23.346 MB/sec).
> ... but the database remains grey and inaccessible
> Do I need something else in my code above or is the problem caused by
> something else?
> Thanks,
> :o)
> --
> Jesper Stocholm
> http://stocholm.dk
|||"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
news:uT0ZS74rFHA.2604@.TK2MSFTNGP14.phx.gbl:
> Specify RECOVERY instead of NORECOVERY.
>
Yes! it works ... thanks a lot for your prompt reply :o)
The last task I need to perform is to grant a sql-login on my
databaseserver select access on all tables in the newly restored database.
However if I look in BOL it seems that it is only possible to grant access
to a object like a table or view. Is this correct?
Thanks again,
Jesper Stocholm
http://stocholm.dk
Japo stole slges - http://japoarmstole.stocholm.dk
|||Check out the db_datareader database group. It will grant SELECT permissions on all objects.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jesper Stocholm" <j@.stocholm.invalid> wrote in message
news:Xns96C561B32326Fstocholmdk@.207.46.248.16...
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
> news:uT0ZS74rFHA.2604@.TK2MSFTNGP14.phx.gbl:
>
> Yes! it works ... thanks a lot for your prompt reply :o)
> The last task I need to perform is to grant a sql-login on my
> databaseserver select access on all tables in the newly restored database.
> However if I look in BOL it seems that it is only possible to grant access
> to a object like a table or view. Is this correct?
> Thanks again,
> --
> Jesper Stocholm
> http://stocholm.dk
> Japo stole slges - http://japoarmstole.stocholm.dk
sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment