الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

عمل نسخة احتياطية للبيانات!

مغلق
بدأه باسم في 1 يناير 2003 · 18 رد · 1,422 مشاهدة · في منتدى تصميم صفحات الويب
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم..

كيف يمكنني عمل نسخة احتياطية (backup) لقاعدة بيانات من نوع SQL server عن طريق كود ASP دون الحاجة الى الEnterprise Manger

اي بضغطة زر واحدة يروح يعمل نسخة من البيانات المخزنة عن طريق كود مكتوب بASP

و شكرا مقدما

:)

#2

!

#3

هل تقصد ان تجعل المستخدم يقوم بعمل ذلك عن طريق asp ??

#4

نعم اقصد ذلك

اما من مجيب

#5

أخي انا اسف بسبب تراكم الاختبارات و المشاريع الجامعية علي ..

لكن يمكنني أن أدلك على فكرة وهي نسخ ملف قاعدة البيانات من مجلد إلى مجلد اخر تسميه Archive طبعا يمكنك أن تتابع موضوع الأخ محمد بدوي المثبت بخصوص التعامل مع الملفات ..

حظا سعيدا و سامحني على التقصير لاني لا املك وقت لأجرب أي كود :confused:

You can fly while you can touch the sky

#6

عذرك معك اخي العزيز..

لكني اتحدث هنا عن قاعدة بيانات من نوع SQL server و عمل نسخة احتياطية عن طريق كود ASP

#7

و ما المشكلة ؟؟ اعتقد مفهوم عند كل مبرمج أن قاعدة البيانات في حد ذاتها ملف .. إذا يمكنك من كود ASP أن تنسخ ملف من مكان لمكان لذا نصحتك بأن تراجع درس التعامل مع الملفات ..

هل وضحت الفكرة الان ؟؟

You can fly while you can touch the sky

#8

اقتراح

بالنسبة للنسخ من SQL server

يمكن عمل ملف اكسس بتصميم مكافئ لل sql

و نسخ البيانات اليه

#9

الفكرة الأساسية كما هو واضح هو أن يقوم شخص من الموقع بعمل backup سواء كان مدير أو عضو أو .... بمجرد الضغط على زر معين بدون الحاجة للرجوع الى الEnterprise Manger ، على ما أعتقد أن المهمة تتعلق بكود خاص يوجه ب SQL scriptبحاول ان شا الله احضاره

شكرا

رواد خميس حماد

#10

الاخوة محمد ابو صلاح و محمد طاهر..اشكركم

الاخ رواد :هذا هو المطلوب بالضبط:)

#11

Here is how to backup SQL Server database using ASP.I found this code in the Visual Basic samples that comes with SQL Server but since all these libraries are COM components ,you can always convert the code to work from ASP

<%
Set SQLSvr = Server.CreateObject("SQLDMO.SQLServer")
Set Backup = Server.CreateObject("SQLDMO.Backup")
SQLSvr.Connect "madaniora", "sa",""

 Backup.Database = "Ecommerce"
 Backup.Files = "c:Ecommerce.bak" ' or use Server.MapPath
 Backup.SQLBackup SQLSvr

SQLSvr.DisConnect
Set SQLSvr =nothing
Set Backup = nothing
%>

change "madaniora" to your server name,"sa" to your username,"" to your password.Change "Ecommerce" to your database name

SQLDMO is a great library ,try to explore it using the documentation and the samples.The samples are under CD DIR:DEVTOOLSsamplessqldmo

Hope this helps

Madani

#12
<%

Set SQLSvr = Server.CreateObject("SQLDMO.SQLServer")

Set Backup = Server.CreateObject("SQLDMO.Backup")

SQLSvr.Connect "local", "basem","bsm"



Backup.Database = "nas"

Backup.Files = "c:nas.bak" ' or use Server.MapPath

Backup.SQLBackup SQLSvr



SQLSvr.DisConnect

Set SQLSvr =nothing

Set Backup = nothing

%>

حاولت في بداية الامر تطبيقه على جهازي بقاعدة بيانات موجودة فيه

حولته الى الكود اعلاه ظهر هذا الخطأ

Technical Information (for support personnel)



Error Type:

(0x80004005)

Unspecified error 

/nas/back.asp, line 4
#13

اوكي اشتغل

شكرا لك

و ذلك بتحويل local الى (local)

:):):):)

احم

و لو انه فيها ثقالة دم بس لو سمحت اريد العملية العكسية

يعني استرجاع البيانات من ملف الBak

و شكرا

و اسف على الازعاج

#14

You welcome brother

Here is the restore code.Before executing the asp code,you need to make sure no one is using the database.This includes Enterprise Manager ,Visual Basic Forms connected to the database or even ASP.The code will fail and give errors if a connection to the database is open

<%
Set SQLSvr = Server.CreateObject("SQLDMO.SQLServer")
SQLSvr.Connect "madaniora", "sa",""

Set Restore = Server.CreateObject("SQLDMO.Restore")
Restore.Database = "Ecommerce"
Restore.Files = "c:Ecommerce.bak"
Restore.SQLRestore SQLSvr

SQLSvr.DisConnect
Set SQLSvr =nothing
Set Restore = nothing

%>
#15

تقول لازم يكون ما فيش ارتباط مع قاعدة البيانات

و كيف اضمن ذلك؟.. لان قاعدة البيانات موجودة على سيرفر خارجي للاستضافة.. و أي متصفح للموقع لازم يرتبط معها

يا ترى هل هذا هو السبب اني لما حاولت اطبق الكود السابق حق الBackup على سيرفر الاستضافة طلع معي خطأ Page can not be displayed

?????

:)

#16

Use this query to check the number of connections open.

Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "select count(*) AS USERS from sysprocesses where dbid = db_id('Ecommerce')","Provider=SQLOLEDB.1;database=master;uid=sa;pwd=;server=localhost"
IF rs("USERS") = 0 Then
'write restore code here
Else

'display "try later"
End IF

rs.close

IF the value is 0 then there is no connection open ,so execute restore code,otherwise try later

change Ecommerce to your database name, but leave "master" in the connection string because that's where information about you server are stored

Again , restore can not be done while database is in use.

Madani

#17

اولا اعتذر عن التأخير في الرد

ثانيا اشكرك جدا جدا:)

ثالثا لما اجيت اشغل كود الBackup على سيرفر الاستضافة طلع

Page can not be displayed

Internal error

ممكن اعرف السبب؟؟

:)

#18

That's IE general message.You will find the error in the middle of the page.paste it here so we can unerstand what's going on

Madani

#19
The page cannot be displayed 

There is a problem with the page you are trying to reach and it cannot be displayed. 



--------------------------------------------------------------------------------



Please try the following:



Open the www.mysite.net home page, and then look for links to the information you want. 

Click the  Refresh button, or try again later.



Click  Search to look for information on the Internet. 

You can also see a list of related sites. 









HTTP 500 - Internal server error 

Internet Explorer

هذا الموضوع مغلق.

مواضيع مشابهة