The output file will be a .qcp extension file.
Restoring a .qcp file that is smaller than 2GB is a straight forward process. As below screenshot just selecting Create Project and then checking the last option will be enough. In the next entry i am going to describe how to restore a qcp project file that is bigger than 4GB.
If you are managing an important QC project, making this backup process as a scheduled job is a good option rather than backing up database scheme and file system. You can use following VB code and define a scheduled job on Windows Task Manager that triggers this script. To make sure that this code runs on your host first you have to open the siteadmin and qc application to install the client components like OTAClient and SAClient.
By using this script you can define the domains and projects those you want to back up. Before starting the backup process the script opens a defect on a different project (SUPPORT:QC_BackupProject). When the job completes the defect will be Fixed and Closed and then the alarm mail will be sent. The script must be copied on the backup server and a scheduled task must be defined by using Windows Task Manager.
Dim v_qcURL, sa, v_username, v_pasword Dim v_domain, v_project, v_date, v_fileName, bugId, v_summary Dim v_projectList, v_domainProject, v_domainProjectArray v_qcURL = "http://<hostname>:8080/qcbin" v_projectList = "DOMAIN:PROJECT_I;DOMAIN:PROJECT_II;DOMAIN:PROJECT_III" v_username = "site_admin_user" v_password = "site_admin_password" For each v_domainProject in split(v_projectList,";") v_domainProjectArray = split(v_domainProject,":") v_domain = v_domainProjectArray(0) v_project = v_domainProjectArray(1) v_year = Year(Now) v_month = Month(Now) v_day = Day(Now) v_hour = Hour(Now) v_minute = Minute(Now) v_second = Second(Now) If v_month<10 Then v_month = "0" & v_month End If If v_day<10 Then v_day = "0" & v_day End If If v_hour<10 Then v_hour = "0" & v_hour End If If v_minute<10 Then v_minute = "0" & v_minute End If If v_second<10 Then v_second = "0" & v_second End If v_date = v_year & v_month & v_day & v_hour & v_minute & v_second v_fileName = "D:\DO_NOT_REMOVE\QCBACKUPS\" & v_date & "_" & v_project & ".qcp" v_summary = "For project <" & v_domainProject & "> backup started: " & v_date bugId = openDefect (v_summary) Set sa = CreateObject("SAClient.SaApi") sa.Login v_qcURL, v_username, v_password sa.SendAllQualifiedNow "SUPPORT","QC_BackupProject" sa.SendMessageToProjectConnectedUsers v_domain, v_project, "This project is going to be deactivated due to maintenence." sa.DisconnectProject v_domain, v_project sa.DeactivateProject v_domain, v_project sa.ExportProject v_domain, v_project, v_fileName sa.ActivateProject v_domain, v_project Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFile(v_fileName) fixAndCloseDefect bugId, v_fileName & ": " & round((f.Size/1024)/1024,2) & " MB" sa.SendAllQualifiedNow "SUPPORT","QC_BackupProject" Next sa.Logout Function openDefect(p_summary) v_detectionDate = Day(Now) & "." & Month(Now) & "." & Year(Now) If Day(Now)<10 Then v_detectionDate = "0" & Day(Now) & "." & Month(Now) & "." & Year(Now) End If If Month(Now)<10 Then v_detectionDate = Day(Now) & ".0" & Month(Now) & "." & Year(Now) End If If Month(Now)<10 And Day(Now)<10 Then v_detectionDate = "0" & Day(Now) & ".0" & Month(Now) & "." & Year(Now) End If set tdc = createobject("TDApiOle80.TDConnection") tdc.InitConnectionEx "http://<hostname>:8080/qcbin" tdc.Login "mehmet.kahraman","pass" tdc.Connect "SUPPORT","QC_BackupProject" Set bfact = tdc.BugFactory Set mybug = bfact.AddItem (null) mybug.Summary = p_summary mybug.Status = "Open" mybug.Field("BG_SEVERITY") = "2-Medium" mybug.DetectedBy = "mehmet.kahraman" mybug.Field("BG_DETECTION_DATE") = v_detectionDate mybug.Post() bugId = mybug.ID tdc.Logout tdc.Disconnect openDefect = bugId End Function Function fixAndCloseDefect(p_bugId, p_comment) set tdc = createobject("TDApiOle80.TDConnection") tdc.InitConnectionEx "http://<hostname>:8080/qcbin" tdc.Login "mehmet.kahraman","pass" tdc.Connect "SUPPORT","QC_BackupProject" Set bfact = tdc.BugFactory Set bgfilter = bfact.Filter bgfilter.Filter("BG_BUG_ID") = p_bugId Set bglist = bgfilter.NewList For Each theBug In bglist Set bg = bfact.Item(theBug.ID) bg.Field("BG_STATUS") = "Closed" bg.Field("BG_DEV_COMMENTS") = "Backup completed on <backup_host>: " & p_comment bg.Post() Next tdc.Logout tdc.Disconnect End Function |
To manage the old backup files you can define another job for the following script (deletes qcp files those are older than 10 days). To accomplish this you have to put this piece of code in a batch file and define another scheduled job that calls this batch file. forfiles.exe executable file must be in the same directory with the batch file.
Sometimes the qcp file may not be downloaded to the client that runs siteadmin panel. For this case you've to check the QC app server for the qcp file. It should be located on this path: <<<InstallationPath>>>\HP\ALM\repository\export\export<<<timestamp>>>.qcp
forfiles.exe /p D:\DO_NOT_REMOVE\QCBACKUPS /m *.qcp /d -10 /c "cmd /c del @file" |
8 comments:
I have tried to run the code suggested in the blog after necessary changes but it gives error on line 42
Error: ActiveX component can't create object: "SAClient.SaApi"
Code: 800A01AD
Hi,
This VB code uses the dll files and componenets (like OTAClient and SAClient) that are installed while you open the QC application.
Can you try to open the QC application and Siteadmin page with the Internet Explorer to make sure that client components and dll files installed?
http://serveradres:port/qcbin/SiteAdmin.jsp
http://serveradres:port/qcbin/start_a.jsp
hi
is this a default functionality or company needs to have this included in the contract as a feature
Hello,
This is just a workaround solution for making backups scheduled and put the backup files on another server. Incase of any emergency server problem you can restore from these backup files easier than restoring the filesystem and database.
HP advises you to backup your filesystem and DB server separetely.
Regards.
Hi,
I tried to run the code but facing the following issue
Error: Invalid Server response[ERR_SEP]
Code: 80040482
Source: SAClient.SAapi.9
Error coming at line ... sa.ExportProject v_domain, v_project, v_fileName
Could you help me with this ?
Regards
Kiran
Hi Kiran
What is the size of the project you want to export?
Can you check this post:
http://qualitesting.blogspot.com.tr/2013/06/exporting-qc-projects-bigger-than-4gb.html
Hello Srinu,
Please check this post:
http://qualitesting.blogspot.com.tr/2013/06/exporting-qc-projects-bigger-than-4gb.html
To reduce the project size first you've to move the repository files to somewhere else while project is deactivated.
Then you can export the project.
Be carefull not to activate the project until you put the repository files to its original directory.
Regards.
Awesome work, So if you need any converter for file converting then use this one;
Simple File Converter
Post a Comment