2010-12-14 17 views

答えて

6

短い回答:いいえ
長い回答:PERFORCEデータのバックアップと回復について知る必要があるのは、Manualです。せっかちなため一言で言えば:;この手順が成功したことを確認してください

  1. p4が// ...
    (サーバーの整合性を確認してください)
  2. P4の管理チェックポイント
    (チェックポイントを作ることを確認します)
  3. バックチェックポイントファイルと古いジャーナルファイル
    (アップあなたが戻ってバージョン化ファイル
    アップ
  4. (それはだ)すべきジャーナル・ファイル、とのPERFORCEを実行した場合PERFORCEサーバディレクトリ内のdb。*ファイルと混同しないでください。)

しかし、特にさまざまな復元シナリオについては、マニュアルをお読みください。覚えておいてください: バックアップは正常に動作しますが、それは失敗したリストアです。

+0

ステップ3を使用すると、新しいチェックポイントを作成したら、あなたは、古いジャーナル・ファイルを必要としない、間違っています。ドキュメントを再読み込みします。さらに、新しいチェックポイントを作成したくない場合は、ステップ1と2をスキップして現在のジャーナルファイルをバックアップするだけの理由があります。 – cmcginty

+0

バックアップの実行中に何も送信しない単一ユーザーの単純なインストールの場合、サーバーの停止(例:p4 admin stop)、データベースファイルとデポファイルのコピーの作成、サーバーの再起動? – Joe

4

p4マニュアルの回答(permalink)のjhwistの正確さに加えて、私は数年間、Perforceの使用中に学んだことをいくつか追加したいと思います。

... P4データベース上で検証を実行するリポジトリのサイズに応じて

は中にそれがにロックされ、誰もが任意のクエリを実行することはできませんいくつかの時間を取ることができます。 P4データベースをロックすると、ユーザーにいくつかのフロー・エフェクトが与えられます。たとえば、この時間にP4SCCプラグイン(Visual Studio統合用)を使用している、強制的に制御を取り戻さなければならない。

ソリューション

  1. スポーン異なるポート(p4d_2)
  2. にP4Dの第2のインスタンスメインインスタンス(p4d_1)を終了/中断。
  3. p4 verify //...を実行し、p4d_2を使用してチェックポイントを実行します。
  4. ストレージアレイ上の物理バージョンファイルをバックアップします。
  5. キルp4d_2。
  6. p4d_1を再起動します。

また、このようはおそらく夜間や週末に自動化されたプロセスで実行するよりも多くなりますが、それは成功したことを確認するために徹底的にチェックポイントログファイルを読み取る必要がことを十分に強調することはできませんすることができますそうしないと、復元を実行する必要があるときには難しい状況になります(次の点を読んでください)。バックアップを設定して忘れるべきではありません。

PERFORCEバックアップの詳細については、PERFORCEのホワイトペーパーHigh Availability And Disaster Recovery Solutions For Perforceを参照してください。

HTH、私は自分の開発ワークステーション上の追加のバックアップ戦略を使用している

0

FWIW。私は毎晩実行されるperlスクリプトを持っており、与えられた作業領域リストからPerforceからチェックアウトしたすべてのファイルを見つけます。そのファイルのリストは、通常のワークステーションのバックアップ手順の一部としてバックアップされます。チェックアウトされたファイルを見つけるためのPerlスクリプトは、私にとってかなり難しいようです。私はそれを書かず、特にPerlに精通していません。

誰かが興味があれば、私はそれをどのように呼び出すかと一緒にここに投稿することができます。

このスクリプトは、PERFORCEが「シェルビング」機能を実現する前に開発されたことに注意してください。毎晩(私の現在のバックアップ戦略に加えて、またはその代わりに)自分の仕事を「棚上げ」するスクリプトを用意する方が良いかもしれません。ここで

はスクリプトです:

# This script copies any files that are opened for any action (other than 
# delete) in the specified client workspace to another specified directory. 
# The directory structure of the workspace is duplicated in the target 
# directory. Furthermore, a file is not copied if it already exists in the 
# target directory unless the file in the workspace is newer than the one 
# in the target directory. 

# Note: This script looks at *all* pending changelists in the specified 
# workspace. 
# Note: This script uses the client specification Root to get the local 
# pathname of the files. So if you are using a substituted drive for the 
# client root, it must be properly substituted before running this script. 

# Argument 1: Client workspace name 
# Argument 2: Target directory (full path) 

use File::Path; 
# use File::Copy; 
use File::Basename; 
use Win32; 

if ($#ARGV != 1) { 
    die("usage: $0 client_name target_directory\n"); 
} 

my $client = shift(@ARGV); 
my $target_dir = shift(@ARGV); 
my @opened_files =(); 
my $client_root = ""; 
my $files_copied = 0; 

# I need to know the root directory of the client, so that I can derive the 
# local pathname of the file. Strange that "p4 -ztag opened" doesn't give 
# me the local pathname; I would have expected it to. 

open(CLIENT_SPEC, "p4 -c $client client -o|") 
     || die("Cannot retrieve client specification: $!"); 
while (<CLIENT_SPEC>) { 
    my ($tag, $value) = split(/\s/, $_, 2); 
    if ($tag eq "Root:") { 
     $value = chop_line($value); 
     $client_root = $value; 
    } 
} 
close(CLIENT_SPEC); 
if ($client_root eq "") { 
    die("Unable to determine root of client $client\n"); 
} elsif (substr($client_root, -1) ne "\\") { 
    $client_root = $client_root . "\\"; 
} 

# Use the -ztag option so that we can get the client file path as well as 
# the depot path. 

open(OPENED_FILES, "p4 -c $client -ztag opened|") 
     || die("Cannot get list of opened files: $!"); 
while (<OPENED_FILES>) { 
    # What we do is to get the client path and append it onto the 
    # @opened_files array. Then when we get the action, if it is a delete, 
    # we pop the last entry back off the array. This assumes that the tags 
    # come out with clientFile before action. 

    $_ = chop_line($_); 
    my ($prefix, $tag, $value) = split(/\s/, $_, 3); 
    if ($tag eq "clientFile") { 
     push(@opened_files, $value); 
    } 
    if (($tag eq "action") && ($value eq "delete")) { 
     pop(@opened_files); 
    } 
} 
close(OPENED_FILES); 

# Okay, now we have the list of opened files. Process each file to 
# copy it to the destination. 

foreach $client_path (@opened_files) { 

    # Trim off the client name and replace it with the client root 
    # directory. Also replace forward slashes with backslashes. 

    $client_path = substr($client_path, length($client) + 3); 
    $client_path =~ s/\//\\/g; 
    my $local_path = $client_root . $client_path; 

    # Okay, now $client_path is the partial pathname starting at the 
    # client's root. That's the path we also want to use starting at the 
    # target path for the destination. 

    my $dest_path = $target_dir . "\\" . $client_path; 
    my $copy_it = 0; 

    if (-e $dest_path) { 
     # Target exists. Is the local path newer? 
     my @target_stat = stat($dest_path); 
     my @local_stat = stat($local_path); 

     if ($local_stat[9] > $target_stat[9]) { 
      $copy_it = 1; 
     } 
    } else { 
     # Target does not exist, definitely copy it. But we may have to 
     # create some directories. Use File::Path to do that. 

     my ($basename, $dest_dir) = fileparse($dest_path); 
     if (! (-e $dest_dir)) { 
      mkpath($dest_dir) || die("Cannot create directory $dest_dir\n"); 
     } 
     $copy_it = 1; 
    } 

    if ($copy_it) { 
     Win32::CopyFile($local_path, $dest_path, 1) 
       || warn("Could not copy file $local_path: $!\n"); 
     $files_copied++; 
    } 
} 
print("$files_copied files copied.\n"); 

exit(0); 

################ Subroutines ######################################### 

# chop_line removes any trailing carriage-returns or newlines from its 
# argument and returns the possibly-modified string. 

sub chop_line { 
    my $string = shift; 

    $string =~ s/[\r\n]*\z//; 
    return $string; 
} 

実行するには:

REM Make sure that we are pointing to the current Perforce server 
P4 set -s P4PORT=MyPerforceServer:ThePortThatPerforceIsOn 


p4 set p4client=MyPerforceWorkspace 

REM Copy checked out files to a local directory that will be backed up 
.\p4backup.pl MyPerforceWorkspace c:\PerforceBackups\MyPerforceWorkspace_backup 
関連する問題