HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How do I send a database to someone else?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
elsesomeonedatabasehowsend

Problem

I am working with a more experienced database admin and he wants me to send him a database that I created. However, I cannot figure out where the database is stored on disk. I am using Microsoft SSMS.

Solution

Select a.name, b.physical_name 
from sys.databases a 
join sys.master_files b 
    on a.Database_id = b.database_id 
Where a.name = 'NAME_OF_YOUR_DATABASE'


This will show you the location on disk.. (can't move it though).

Backup the database:

BACKUP Database NAME_OF_YOUR_DATABASE
To Disk = N'C:\Databases\NAME_OF_YOUR_DATABASE.bak With Compression

Code Snippets

Select a.name, b.physical_name 
from sys.databases a 
join sys.master_files b 
    on a.Database_id = b.database_id 
Where a.name = 'NAME_OF_YOUR_DATABASE'
BACKUP Database NAME_OF_YOUR_DATABASE
To Disk = N'C:\Databases\NAME_OF_YOUR_DATABASE.bak With Compression

Context

StackExchange Database Administrators Q#153437, answer score: 5

Revisions (0)

No revisions yet.