#!/bin/bash
source $(cd `dirname $0`; pwd)/common
parameterSize=3

if [ $# = 0 ]
then
	echo "数据库还原工具需要参数："
	echo "1. 数据库名称；"
	echo "2. 还原到的目标数据库父目录，一般是名称为 “database” 的目录；"
	echo "3. 进行还原的备份文件的路径。"
else
    needStopServer   #需要停止服务才能使用该工具
    if [ $? = 1 ]
    then
	    if [ $# != $parameterSize ]
	    then
	    	echo "参数个数不对。"
	    else
	        java -classpath "$basePath/$version/lib/*:." kd.bos.olap.repairTools.OlapServerToolsMain -allowRunWithDatabase:true -function:recovery -functionParameters:$1,$(getAbsolutePath $2),$(getAbsolutePath $3)
		fi
	fi
fi