在Oracle中更改临时TableSpace时无效的文件名

时间:2017-04-28 23:57:16

标签: oracle javafx

我尝试通过添加新文件来更改临时表空间,但是我有关于文件名的错误:

  

java.sql.SQLSyntaxErrorException:ORA-02236:文件名无效

这是我的代码:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package projetoracle;

import java.io.IOException;
import java.net.URL;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.Stage;


public class FXML_mofification_temporaire2Controller implements Initializable {
@FXML
    private ComboBox<String> name;

    @FXML
    private TextField namefile;

    @FXML
    private Button modification;

    @FXML
    private TextField taille1;

    @FXML
    private ComboBox<Label> extend;

    @FXML
    private ComboBox<Label> unite1;

    @FXML
    private ComboBox<Label> unite2;

    @FXML
    private TextField taille2;

    @FXML
    private ComboBox<Label> logging;

    @FXML
    private ComboBox<Label> statut;

    @FXML
    private Button retour;


    @FXML
    void handleButtonActionc(ActionEvent event) throws SQLException, ClassNotFoundException {
        String createQuery1;
  String createQuery2;
  String createQuery3;
  String sp = " ";
  createQuery1 = "ALTER TABLESPACE" + sp + name.getValue() + sp + "ADD" + sp + "TEMPFILE"+ sp + namefile.getText() + sp + "SIZE" + sp + taille1.getText()+ taille() + sp + autoextend();
  System.out.println(createQuery1);
  createQuery2= "ALTER TABLESPACE " + name.getValue() + sp + journalisation();
  createQuery3= "ALTER TABLESPACE " + name.getValue() + sp + online() ;
  try{
            DBUtil.dbExecuteUpdate(createQuery1);
            DBUtil.dbExecuteUpdate(createQuery2);
            DBUtil.dbExecuteUpdate(createQuery3);
            System.out.println("Succées de modificaton"); 
            Alert alert = new Alert(Alert.AlertType.INFORMATION);
            alert.setTitle("Information Dialog");
            alert.setHeaderText(null);
            alert.setContentText("Modification de "+name.getValue()+" se termine par succée");
            alert.showAndWait();


        }
        catch (Exception e){
            System.out.println("erreur!");
        }
    }

         public String taille() {
        if (unite1.getSelectionModel().getSelectedItem().getText().toString().equals("Ko")) {
            return "K";
        } else if (unite1.getSelectionModel().getSelectedItem().getText().toString().equals("Mo")) {
            return "M";
        } else {
            return "G";
        }
    }

    public String autoextend() {
      if (extend.getSelectionModel().getSelectedItem().getText().toString().equals("Off")) {
            return "AUTOEXTEND OFF";
        } else {
            return "AUTOEXTEND ON " + "NEXT " + taille2.getText().toString() + tailleext();
        }
    }

     private String journalisation()
        {
            if (logging.getSelectionModel().getSelectedItem().getText().toString().equals("logging"))
                return "LOGGING";
            else
                return "NOLOGGING";
        }

    public String tailleext() {
        if (unite2.getSelectionModel().getSelectedItem().getText().toString().equals("Ko")) {
            return "K";
        } else if (unite2
                .getSelectionModel().getSelectedItem().getText().toString().equals("Mo")) {
            return "M";
        } else {
            return "G";
        }
    }
          public String online()
        {
            if (statut.getSelectionModel().getSelectedItem().getText().toString().equals("Online"))
                return "ONLINE";
            else
              return "OFFLINE";
        }








      @FXML
    void handleButtonActionretour(ActionEvent event) throws IOException {
         Parent home_page_parent = FXMLLoader.load(getClass().getResource("FXML_choice_table_permanent.fxml"));
        Scene home_page_scene = new Scene(home_page_parent);
        Stage app_stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
        app_stage.hide(); //optional
        app_stage.setScene(home_page_scene);
        app_stage.show();  


    }



    private void ComboObj(){
        try {  
             DBUtil.dbConnect();

          ResultSet rs = DBUtil.dbExecuteQuery("select DISTINCT TABLESPACE_NAME from sys.dba_tablespaces where CONTENTS='TEMPORARY'");

            while (rs.next()){
                String id = rs.getString("TABLESPACE_NAME");
                name.getItems().add(id);
                }
        }catch(Exception e){
             e.toString();
        } 
    }

   @Override
    public void initialize(URL location, ResourceBundle resources) {
      ComboObj();  

       unite1.getItems().add(new Label("Ko"));
        unite1.getItems().add(new Label("Mo"));
        unite1.getItems().add(new Label("Go"));

        unite2.getItems().add(new Label("Ko"));
        unite2.getItems().add(new Label("Mo"));
        unite2.getItems().add(new Label("Go"));

        statut.getItems().add(new Label("Online"));
        statut.getItems().add(new Label("Offline"));

        extend.getItems().add(new Label("On"));
        extend.getItems().add(new Label("Off"));

        logging.getItems().add(new Label("Logging"));
        logging.getItems().add(new Label("No Logging"));


    }



}

我尝试使用数据表空间相同的代码,它的工作原理!

0 个答案:

没有答案