1 Sqlsever Location of Data Log Files
1 Sqlsever Location of Data Log Files
logfile (.ldf)
The transaction log files record all transactions and the database modifications made by each
transaction.
Transaction log files contain the information that is required to recover all transactions in the
database.
USE master;
SELECT
FROM sys.master_files;
This will return a list of all data files and log files for the SQL Server instance.
Note:
"NAME" is the logical name of the file
"FILENAME" is the new path of the file.
This will return only the data and log files for the HR database.
II. or by SQL Server Management Studio (SSMS)
right-clicking on the database name in and choosing "Properties" then "Files"
USE master;
CREATE DATABASE HR
ON PRIMARY
LOG ON
65536KB)
;
4. Add Database Files and Filegroups
GO
65536KB)
TO FILEGROUP Audit_FG;
GO
FILEGROWTH = 5%)
ON Audit_FG;
USE master
GO
ALTER DATABASE HR SET OFFLINE
2. Then, physically move the data and log files to new locations:
3. The next step is to ALTER the database to use new paths of its files:
hr_log1.ldf')
This should be done for all the files that we want to relocate.
4. bring the database online
USE master
GO
ALTER DATABASE HR REMOVE FILE HR_log1