11g 新特性 real time apply +real time query

主库

由不同步ASYNC改为SYNC

SQL> alter system set log_archive_dest_2='service=standby SYNC VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby' scope=spfile;

System altered.

备库由日志恢复模式变成 real time query

A physical standby database can be open for read-only access while Redo Apply is
active if a license for the Oracle Active Data Guard option has been purchased. This
capability is known as Real-time Query.
A physical standby database instance cannot be opened if Redo Apply is active on that
instance or on any other mounted instance. Use the following SQL statements to stop
Redo Apply, open a standby instance read-only, and restart Redo Apply:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
SQL> ALTER DATABASE OPEN;
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE
2> DISCONNECT;

SQL> recover managed standby database cancel;                                        
Media recovery complete.
SQL> recover managed standby database using current logfile disconnect from session; 
Media recovery complete.

主库进行插入:

SQL> insert into paul select * from paul;                                                                                                    

1024 rows created.

SQL> commit;                                                                                                                                 

Commit complete.

SQL> select count(*) from paul;                                                                                                              

  COUNT(*)
----------
      2048

备库进行查询

检查recovery_managed

SQL> select recovery_mode from v$archive_dest_status where dest_id=2
  2  ;
 
RECOVERY_MODE
-----------------------
MANAGED REAL TIME APPLY

SQL> select count(*) from paul;                                                      

  COUNT(*)
----------
      2048


 由MANAGED REAL TIME APPLY 变为managed 模式

SQL> recover managed standby database cancel;                                        
Media recovery complete.
SQL> recover managed standby database disconnect from session;                       
Media recovery complete.

SQL> select recovery_mode from v$archive_dest_status where dest_id=2
  2  ;
 
RECOVERY_MODE
-----------------------
MANAGED 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7199859/viewspace-413643/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7199859/viewspace-413643/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
To use MySQL table's regular expression match Spark real-time date by Java, you can first establish a JDBC connection to the MySQL database from your Java program. Then, you can use Spark's `DataFrame` API and its built-in functions to read data from the MySQL table and apply regular expression matching to the date column. Here's some sample code: ```java import java.sql.*; import org.apache.spark.sql.*; public class MySQLSparkRegexp { public static void main(String[] args) { // Establish JDBC connection String url = "jdbc:mysql://localhost:3306/mydatabase"; String user = "myuser"; String password = "mypassword"; try (Connection conn = DriverManager.getConnection(url, user, password)) { // Read data from MySQL table String query = "SELECT * FROM mytable"; DataFrame df = new DataFrameReader(conn) .jdbc(url, query, new Properties()); // Apply regular expression matching to date column Column dateCol = df.col("date"); Column regexpCol = functions.expr("regexp_extract(date, 'myregexp', 0)"); DataFrame result = df.select(dateCol, regexpCol); // Show resulting DataFrame result.show(); } catch (SQLException e) { e.printStackTrace(); } } } ``` In this sample code, we establish a JDBC connection to a MySQL database and read data from a table called `mytable`. We then apply regular expression matching to the `date` column using Spark's `expr()` function and a regular expression pattern called `myregexp`. Finally, we select the original `date` column and the resulting regular expression column and show the resulting `DataFrame` using Spark's `show()` function.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值