PDA

View Full Version : انتقال دیاگرام ها روی سرور



fereshte22
شنبه 27 بهمن 1386, 11:25 صبح
سلام
من از طریق sql script دیتابیسم را اپلود کردهام
ولی مشکلی که دارم اینه که دیاگرام هایی که در دیتابیس دارم فرستاده نمیشود.
در یه تاپیک اقای ثباتی فرموده بودند که اطلاعات دیاگرام در جدول dtproperties قرار داره
ولی من چنین جدولی پیدا نکردم

وقتی هم که اسکریپت ساخته میشود گزینه ای برای دیاگرام ها پیدا نکردم
میشه بگبد که چطوری باید این دیاگرام ها را منتقل کنیم
ممنون

reza_rad
شنبه 27 بهمن 1386, 11:42 صبح
How To Move a Database Diagram (http://support.microsoft.com/kb/320125)

fereshte22
شنبه 27 بهمن 1386, 20:05 عصر
سلام
اقای راد از کمکی که کردید خیلی ممنون هستم
فقط چند تا سوال دارم
من وقتی از کد زیر برای یافتن جداول دیتابیس استفاده میکنم


use pubs
select name from sysobjects
where xtype = 'U'
order by name

جدولی به نام dtproperties نشون داده نمیشود و یه جدول دیگر به نام sysdiagrams نشون داده میشود
علت چی میتونه باشد؟
در ضمن من وقتی عملیات انتقال دیاگرام را انجام دام یه جدول که مشخصات دیاگرام ها را نشون میدهد منتقل میشود و در قسمت دیاگرام ها چیزی وجود ندارد.
ایا به همین صورت باید منتقل شود؟
ممنون

AminSobati
شنبه 27 بهمن 1386, 23:57 عصر
شاید دارین با SQL Server 2005 کار میکنین؟

fereshte22
یک شنبه 28 بهمن 1386, 10:24 صبح
شاید دارین با SQL Server 2005 کار میکنین؟
بله با 2005 کار میکنم یعنی روش کار فرق میکند؟

Elham_gh
یک شنبه 28 بهمن 1386, 12:37 عصر
بله 2005 فرق داره:
http://support.microsoft.com/kb/314546

fereshte22
یک شنبه 28 بهمن 1386, 13:24 عصر
بله 2005 فرق داره:
http://support.microsoft.com/kb/314546
عذر میخواهم در این لینک همون روش قبلی گفته شده است

Elham_gh
یک شنبه 28 بهمن 1386, 15:07 عصر
عذر میخواهم در این لینک همون روش قبلی گفته شده است

این دو تا لینک یکی هستند؟!!!!!!!!!!!!!!!!!!
اولی:


How to Move a Database Diagram in SQL Server 7.0 and 2000
1. Expand the Databases folder.
2. Right-click the database that contains the diagram that you want to copy, click All Tasks, and then click Export Data
3. In the Data Transformation Services Import/Export Wizard, click Next.
4. On the Choose a Data Source page, click Next.
5. On the Choose a Destination page, select the server and database to which you want to transfer the database diagram. Click Next.
6. On the Specify Table Copy or Query page, click to select the Use a Query to specify the database to transfer check box, and then click Next.
7. On the Type SQL Statement page, type the following line, and then click Next:select * from dtproperties

8. On the Select Source Table and Views page, click the Results destination, and then change it to dtproperties. Click Next.
9. On the Save, Schedule, and Replicate Package page, click to select the Run Immediately check box, and then click Next.
10. On the Completing the DTS Import/Export Wizard page, click Finish.
11. Click OK, and then click Done to exit the wizard.



دومی:


If you are using SQL Server 2005
You can use the same method to migrate data from SQL Server 7.0 or SQL Server 2000. However, the management tool in Microsoft SQL Server 2005 differs from the management tool in SQL Server 7.0 or in SQL Server 2000. You should use the SQL Server Management Studio instead of the SQL Server Enterprise Manager, the SQL Server Import and Export Wizard (DTSWizard.exe) instead of the Data Transformation Services Import and Export Data Wizard.
Backup and restore
Back up the user databases on the source server, and then restore the user databases to the destination server.• The database can be used when the backup is in process. If users perform INSERT, UPDATE, or DELETE statements on the database after the backup is completed, the backup will not contain these changes. If you must transfer all changes, you can transfer the changes with minimal downtime if you perform both a transaction log backup and a full database backup.1. Restore the full database backup on the destination server and specify the WITH NORECOVERY option.

Note To prevent additional database modifications, direct users to quit database activity on the source server.
2. Perform a transaction log backup and restore the transaction log backup to the destination server by using the WITH RECOVERY option. Downtime is limited to the time of the transaction log backup and restore. For more information, see the "RESTORE" sub-topic in the "Transact-SQL Reference" topic of SQL Server Books Online.

• The database on the destination server will be the same size as the database on the source server. To reduce the size of the database, you must either reduce the source database before you perform the backup, or reduce the destination database after the restore is completed. For more information, see the "Shrinking a Database" sub-topic in the "Creating and Maintaining Databases" heading of SQL Server Books Online.
• If you restore the database to a different file location than the source database, you must specify the WITH MOVE option. For example, on the source server the database is in the D:\Mssql\Data folder. The destination server does not have a D drive, and you want to restore the database to the C:\Mssql\Data folder. For more information about how to restore a database to a different location, click the following article numbers to view the articles in the Microsoft Knowledge Base:
221465 (http://support.microsoft.com/kb/221465/) INF: Using the WITH MOVE option with the RESTORE statement
304692 (http://support.microsoft.com/kb/304692/) INF: Moving SQL Server databases to a new location by using BACKUP and RESTORE
• If you want to overwrite a pre-existing database on the destination server, you must specify the WITH REPLACE option. For more information, see the "RESTORE" sub-topic in the "Transact-SQL Reference" topic of SQL Server Books Online.
• Depending on the version of SQL Server to which you restore, the character set, sort order, and Unicode collation may have to be the same on both the source and destination servers. For more information, see the "Note About Collation" section of this article.

Sp_detach_db and Sp_attach_db stored procedures
To use the sp_detach_db and sp_attach_db stored procedures, follow these steps:1. Detach the database on the source server by using the sp_detach_db stored procedure. You must copy the .mdf, .ndf and .ldf files associated with the database to the destination server. See this table for a description of the file types:File name extension Description
.mdf Primary data file
.ndf Secondary data file
.ldf Transaction log file

2. Attach the database on the destination server by using the sp_attach_db stored procedure and point to the files you copied to the destination server in the previous step. For more information about how to use these methods, click the following article number to view the article in the Microsoft Knowledge Base:
224071 (http://support.microsoft.com/kb/224071/) INF: Moving SQL Server databases to a new location by using Detach/Attach
• The database is inaccessible after the detach and you cannot use the database when you copy the files. All data that is contained in the database at the point in time of the detach is moved.
• The character set, sort order, and Unicode collation may have to be the same on both servers when you use the Attach or Detach method. For more information, see the "Note About Collation" section of this article.
.....

fereshte22
یک شنبه 28 بهمن 1386, 16:26 عصر
دوست عزیز منظورم قسمت زیر بود که برای انتقال دیاگرام لینکی گذاشته که همون مقاله قبلی است



For more information, click the following article number to view the article in the Microsoft Knowledge Base:
320125 (http://support.microsoft.com/kb/320125/) (http://support.microsoft.com/kb/320125/) How to move a database diagram

AminSobati
یک شنبه 28 بهمن 1386, 18:22 عصر
این لینک رو حتما ببینید:
http://www.codeproject.com/KB/database/ScriptDiagram2005.aspx

Elham_gh
یک شنبه 28 بهمن 1386, 18:31 عصر
من عنوان رو خوندم فکر کردم درسته .


SELECT INTO dbname1.schamename.sysdiagrams FROM dbname2.schemaname.sysdiagrams

fereshte22
دوشنبه 29 بهمن 1386, 12:25 عصر
سلام
از راهنمایهای همه دوستان ممنون هستم
من دیتابیس را با sql script روی سرور فرستادم
و بعد از اون جدول sysdiagrams را از طریق export روی سرور فرستادم که مشکل حل شد و دیاگرام ها هم منتقل شد