0

我想使用 Oracle Java Cloud SDK 进行 Oracle Cloud Database Backup。帮我做这个!

4

2 回答 2

1

乔说的。CLIENT在他的例子中是DatabaseClient

https://docs.us-phoenix-1.oraclecloud.com/tools/java/latest/com/oracle/bmc/database/DatabaseClient.html

于 2018-02-05T15:43:52.980 回答
1

这是一些示例代码来执行此操作:

private static Backup createBackup(String databaseId) throws Exception {
    DatabaseWaiters waiters = CLIENT.getWaiters();

    String displayName = "db-backup";

    CreateBackupRequest createBackupRequest =
            CreateBackupRequest.builder()
                    .createBackupDetails(
                            CreateBackupDetails.builder()
                                    .databaseId(databaseId)
                                    .displayName(displayName)
                            .build())
                    .build();

    CreateBackupResponse createBackupResponse = CLIENT.createBackup(createBackupRequest);

    Backup backup = createBackupResponse.getBackup();

    waiters.forBackup(
                    GetBackupRequest.builder().backupId(backup.getId()).build(),
                    Backup.LifecycleState.Active,
                    new MaxTimeTerminationStrategy(60 * 60 * 1000),
                    new ExponentialBackoffDelayStrategy(60 * 1000))
            .execute();

    return backup;
}
于 2018-02-02T19:01:46.473 回答