In the database properties screen, there are four tabs: General, Transaction Log, Options, Permissions. In the General Tab, it lists four columns: File name, Location, Space Allocated, File Group.
The string in the File name column has a value such as MY_DATABASE_DAT, whereas the Location column has a value like D:mssql7dataMY_DATABASE.MDF.
The Location value is clearly the Windows file name. The "File name" (which I have seen called the "logical file") is a mystery to me. What is it used for? How can it be changed? Is there a problem if two different databases have the same "logical file" name?
(For example, if you do sp_detach_db, copy the file to another place and then sp_attach_db the new file to another database name, you have two different databases with the same "logical file" name.)
Much thanks to anyone who can shed light on this.
Hi everyone, I have a database (xyz) one Machine A. On the same machine I want to create a copy of the (xyz)database with different name(xyz_1). When I restore with move option it will restore but the thing is logical file names of xyz and xyz_1 are same. I know I can change these file names by manupulating the system table. My question is If I didn't change the logical file names of database xyz_1(new). Is there any problems or issues may arise.
I cannot find the answer to this: how do you update the logical file name for a database? Restore database "Alpha" over "Beta" specifying WITH MOVE parms allows "Alpha"'s physical files to overlay "Beta"'s, but now "Beta"'s logical file names are "Alpha_Data" and "Alpha_Log".
Updating sysfiles directly gives back a 270; "Get outta here!"
Hi Every one One thing i found out that my 2 databases in server A Has same logical file name . I have try to change the name but it is not allowing me to change. I had refer BOL it says that we should have unique logical file name in a server for each database. Question i have is does it going harm me i don't know this if any one u know please suggest me. Problem I already started getting is I do backup 5 small databases of 10 to 20 mb in one tape only. The 2 database which has same logical file name out of which one is getting copied & another is not ,All other database it backup perfecly. But at the same time in a hard disk if i take backup of this database in a same device it works perfecly so i don't understand where the problem is If any has any idea please suggest me Thanks Nirmal.
I'm moving a database (XYZtest) from the test server to the production server via sp_detach/sp_attach. I want the logical file names to be XYZ_data, rather than XYZtest_data, etc. I can easily rename the disk files, but how do I rename the logical file names?
Hi,Is there an option (stored procedure) or whatever to change to logical nameof the databasefile and the database log file ?Arno de Jong, The Netherlands.
Is there a way to rename the logical file for a database. For example, if I am moving a development database into production, I can use backup - but the backup takes the logical file names of the database and puts it into my production server. Now I have a production database with "dev_data1" for a logical file.....Can I change that name....?
Is there a way to rename the logical file names? I'm not talkingspecifically about the physical files, because those can be changedduring a restore, but the values immediately to the left of those inEnterprise Manager such as DBName_Data and DBName_log. EnterpriseManager lets me change them during a restore, but when I do it gives anerror. Any ideas?
A small database ABC with data only 5 mb but its log is growing everyday around 20 mb. I want to shrink its size like for other databases on daily bases.
1. backup log ABC with truncate_only 2. DBCC SHRINKDATABASE (ABC, 10) got following error: <<Cannot shrink log file 2 (ABC_Log) because all logical log files are in use.>>
with no_log also tried but have the same error when dbcc shrinkdatabase.. any idea?
Hi,I am planning to automate a nighty restore of a DB on another servercan someone point me in the right direction with the SQL script tomodify the logical file names to the correct path and not the onescarried over with the DB??i.e the database is to be renamed on the new serverany help much appreciatedMany thanks in advance
Is there any danger with renaming the LOGICAL file names behind the database?
There are a bunch of databases that were restored copies and all of them have the same logical database file name. I'm trying to get some growth data so I want the logical files to be different (prefer them to match the actual database name) so I can more easily identify them.
Am I safe to rename the logical names? I can't think of anything that references those logical file names that I would be breaking [backups, applications].
We generally modify the logical name of a data file or log file from the vendor defined to our standard name. Is there any impact that you know about this? If you have 2 seperate database and accidently you have 2 same logical name .. I dont' think that will be an issue ... correct?
ALTER DATABASE XXX_UAT MODIFY FILE (NAME = 'mdd_Data', NEWNAME = 'XXX_UAT_Data') GO
ALTER DATABASE XXX_UAT MODIFY FILE (NAME = 'mdd_Log', NEWNAME = 'XXX_UAT_Log') GO
Hi,I want to change the logical name of the database. My database name and.MDF has the same name, but the logical name is different. Willchanging it impact anything?--sharif
I have a query. on my search page i have a number of textboxes e.g. title, subtitle, ISBN where users can enter a search string and when they click on a button the data is displayed in the gridview below. my query seems to be bringing up the right records but with some additional records into the gridview. I have tried the same query within the SQL server management studio and it brings back two records like indicated but within my aspx page it brings back 6 additional records that have no relevance to the query. Im quite baffled as to why this is happening and i have debugged but nothing comes to light. my code in my aspx page is as follows: public void BindData(){String _BookID = TxtBookID.Text;String _Title = TxtTitle.Text;String _Subtitle = TxtSubtitle.Text;String _ISBN = TxtISBN.Text;String AuthorFName = TxtForename.Text;String AuthorLName = TxtSurname.Text; SqlDataAdapter ad = new SqlDataAdapter("SELECT Book_ID, Book_ID_Internal AS [Book Internal ID], Title, Subtitle, ISBN, Edition, Publication_Date AS [Published Date] FROM Book WHERE Book_ID_Internal = '" + _BookID + "' OR Title = '" + _Title + "' OR Subtitle = '" + _Subtitle + "'", conn);DataSet ds = new DataSet();ad.Fill(ds, "Book");if (ds.Tables[0].Rows.Count == 0){//if there are no rows returned-state in the gridds.Tables[0].Rows.Add(ds.Tables[0].NewRow());GridView1.DataSource = ds;GridView1.DataBind();int columncount = GridView1.Rows[0].Cells.Count;GridView1.Rows[0].Cells.Clear();GridView1.Rows[0].Cells.Add(new TableCell());GridView1.Rows[0].Cells[0].ColumnSpan = columncount;GridView1.Rows[0].Cells[0].Font.Italic = true;GridView1.Rows[0].Cells[0].Text = "No Records Found";}else{GridView1.DataSource = ds;GridView1.DataBind();}} if i input the same query into SQL management studio: SELECT * FROM Book WHERE Book_ID_Internal = 'ITD 450' OR Title = 'HTML 4.0' it returns two records which is correct. Can anyone see where i am going wrong?
The organisation I'm working for has SQL Server 2005 merge replication up and running on 11 servers in 3 different countries.
Ocasionally we experience problems caused by rows in a logical record relationship being replicated between servers in the wrong order, i.e. an attempt is made to insert child rows before the parent. I am not able to reproduce this behaviour on my test servers.
We have a progress database that we use RS on. The "status" field (active/inactive) is a logical field (true/false). When doing the SQL how do I specify that I want only active records (value = true).
I would like to change the logical filenames for a database on my test server. I know this is done with ALTER DATABASE, but I'm not sure of the exact syntax. Can anyone help?
I've been asked to trouble shoot an installation where many stored procedures are performing poorly. Upon examination I've found that the queries in these procs consume a large volume of logical IO (table scans etc). I'm trying to show that this could cause poor performance of the stored procedures as well as degredation of the server as a whole - but I cant find any suitable counters in Perfmon.
I have a view based on few tables okay I have a query that gives me document details of various revisions Now i also get the latest rev of those if i use a MAX() in my Query
And if i filter for a month of 12/2004 If i query for latest it should give Document1 - rev2
Now i need to get a filter with latest as rev2, plus i also need as a indication of actual latest as rev 7 using a query
How do i do that ...
Coz when i use filter for a month and Max then it does not consider rev7 for that filter and skip the record and if i try to filter only as per month .. i get a wrong info as latest rev2 which is not a true info as per database records.
May i possibly get both ... filtered info as per specific month and also a rev info as what is the latest for a spec document.
Just i need to know is that possible .. in SQl using a query
Any more info needed please mail me on neeraj.jariwala@gmail.com
we consistently have logical page errors on one of our SQL Servers. The output from CHECKDB is shown below. Any ideas why this keeps happening. We recently replaced the disk thinking this would solve the problem.
DBCC results for 'TMP_tbl_Pay_Totals'. Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:391469) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header.
AND later on
Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:398376) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header. Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:398377) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header. Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:398378) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header. Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:398379) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header. Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:398448) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header. Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:398449) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header. Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:398450) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header. Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:398451) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header. Server: Msg 2533, Level 16, State 1, Line 1 Table error: Page (1:398452) allocated to object ID 1412968160, index ID 0 was not seen. Page may be invalid or have incorrect object ID information in its header. Server: Msg 2533, Level 16, State 1, Line 1
Final bit
CHECKDB found 0 allocation errors and 11 consistency errors in database 'ISS'. repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKDB (ISS ).
I have a table with 50% Logical Scan Fragmentation. [ according to Dbcc Showcontig (myTable) ] Why after running DBCC INDEXDEFRAG (myDB,myTable) does it still sit at 50%. Why isn't it lower?
I'm trying to restore about 70 databases onto a new SQL server andwanted to script the creation and restore. I've done the creation withno problems, but on the restore, the logical names (of the originaldata) are all over the place and were historically wrong.So, when I use the script below... I've had to work out the Logicalname for the data and the log file and alter the script accordingly.Creation------------Create Database MyDatabase ON (NAME = MyDatabase_data, FileName ='D:DatabaseMSSQLDataMyDatabase.mdf') LOG ON (NAME = MyDatabase_log,FileName = 'D:DatabaseMSSQLDataMyDatabase.ldf') COLLATESQL_Latin1_General_CP1_CI_ASRestore-----------RESTORE FILELISTONLYfrom disk ='D:DatabaseMSSQLBACKUP2006-08-07MyDatabase_db_200608072100.BAK'restore database MyDatabasefrom disk ='D:DatabaseMSSQLBACKUP2006-08-07MyDatabase_db_200608072100.BAK'with REPLACE,MOVE 'SomeOtherRubbish_Data' TO'D:DatabaseMSSQLDataMyDatabase.mdf',MOVE 'SomeOtherRubbish_Log' TO'D:DatabaseMSSQLDataMyDatabase.ldf'goWhen I then look at the properties of the database, it shows the oldconvention which I don't want.So, even though I've been neat creating the database, it getsoverwritten with the odl rubbish name. How can I change the logicalname so that I can have a nice and neat naming convention ?Oh, Yes I know I added the collation when creating the database, butthat's another thing that we need to address at some point.Thanks in advance
I have three tabels A,B,C having relation of primery & forign key, and i want to fetch data from all three. In case if only A have the values and B & C dont have values, then also i want values. But my simple sql statement dose not show any data, if B & C dont have values.
Any one tell me that how to fetch data from this type of Situation???????
hi we are in the process of developing a project and we r at the initial phase i.e. at the analysis phase and we have been discusssing on what is physical and logical database design. can any body send any links or articals on this will be hightly appreciated.
The many that I have spoken to all are clueless on this one. Thanks in advance for the right solution!
The insert trigger I created works fine (well, nearly fine), except that AFTER the first insert operation (ie second, third etc), it always produces the correct results BUT FOR THE PREVIOUS INSERTED ROW. It is as if there is a latency of one row in the temp table INSERTED.
I would greatly appreciate a 'why', and more importantly, a 'how to fix it' for this problem.
If you need to look at the code, a NOTEPAD file is attached.
Much appreciated
--start trigger-- create trigger UpdateAffiliateEarnings on Orders for insert, update as
--check existence of affiliateid, and for product type select @AffID=AffID, @ProductType=Source from Orders where AffID IS NOT NULL
--get relevant information if @AffID IS NOT NULL begin if @ProductType = 'FLOWER' begin select @Earnings=CONVERT(money,ChargedAmount*CommissionRa te) from Orders o,FlowerOrder t,Commission c where o.OrderID = t.OrderID and t.CommissionID = c.CommissionID and PaymentConfirmedYN='YES' end if @ProductType='PHONE' begin select @Earnings=CONVERT(money,ChargedAmount*CommissionRa te) from Orders o,PhoneOrder t,Commission c where o.OrderID = t.OrderID and t.CommissionID = c.CommissionID and PaymentConfirmedYN='YES' end
--update Affiliate account --get totals to update select @CurrentEarnings=AffTotalEarnings, @AffTotalPayments=AffTotalPayments from Affiliates where AffID=@AffID
--calculate new totals for affiliate account set @AffTotalEarnings=@CurrentEarnings+@Earnings set @AffOutstandingBalance=@AffTotalEarnings-@AffTotalPayments
--update affiliate account to new totals update Affiliates set AffTotalEarnings=@AffTotalEarnings, AffOutstandingBalance=@AffOutstandingBalance where AffID=@AffID
--roll back the transaction if there is an error if @@ERROR !=0 rollback tran end -- end of trigger --