Hatena::ブログ(Diary)

ablog このページをアンテナに追加 RSSフィード Twitter

2015-03-29

Windows 7 on VirutalBox 4.3 のCドライブ拡張した

環境


状況

  • ディスクボリュームはCドライブとDドライブがあり、Cドライブの容量が足りなくなったケース。

手順

VBoxManage modifyhd Win7OBI.vdi --resize 122880
  • Windows7でEドライブを作成してNTFSでフォーマット
  • Windows7再起動
  • Windows7でDドライブのデータをEドライブに移動する
  • Dドライブを削除する
  • Cドライブを拡張する
  • EドライブをDドライブに変更する
  • Windows7再起動

補足

  • スナップショットが存在すると仮想ディスク拡張に失敗するので*1、対象の仮想マシンスナップショットを削除してから仮想ディスクを拡張した。
  • Cドライブに隣合って空き領域がないと拡張できないので、DドライブのデータEドライブに移動し、Dドライブを削除してCドライブを拡張した。

*1:私の記憶が確かなら

2015-03-02

Please run yum-complete-transaction as root

事象

f:id:yohei-a:20150302080809p:image

yum update 後に

There are unfinished transactions remaining. Please run yum-complete-transaction as root.

と怒られた。



対応

rootyum-complete-transaction を実行する。

# yum-complete-transaction
...
Nothing in the unfinished transaction to cleanup.
Cleaning up completed transaction file

2015-02-13

VirtualBox を 4.3.20 から 4.3.22 にアップグレードした

手順は VirtualBox を 4.3.16 から 4.3.20 にアップグレードしたメモ - ablog と同じ。

[root@yazekats-linux ~]# yum update VirtualBox-4.3
(中略)
================================================================================
 Package             Arch        Version                  Repository       Size
================================================================================
Updating:
 VirtualBox-4.3      x86_64      4.3.22_98236_el6-1       virtualbox       68 M

Transaction Summary
================================================================================
Upgrade       1 Package(s)

Total download size: 68 M
Is this ok [y/N]: y
Downloading Packages:
VirtualBox-4.3-4.3.22_98236_el6-1.x86_64.rpm             |  68 MB     02:56     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : VirtualBox-4.3-4.3.22_98236_el6-1.x86_64                     1/2 

Creating group 'vboxusers'. VM users must be member of that group!

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.

Stopping VirtualBox kernel modules [  OK  ]
Uninstalling old VirtualBox DKMS kernel modules [  OK  ]
Trying to register the VirtualBox kernel modules using DKMS [  OK  ]
Starting VirtualBox kernel modules [  OK  ]
  Cleanup    : VirtualBox-4.3-4.3.20_96996_el6-1.x86_64                                                                                                            2/2 
  Verifying  : VirtualBox-4.3-4.3.22_98236_el6-1.x86_64                                                                                                            1/2 
  Verifying  : VirtualBox-4.3-4.3.20_96996_el6-1.x86_64                                                                                                            2/2 

Updated:
  VirtualBox-4.3.x86_64 0:4.3.22_98236_el6-1                                                                                                                           

Complete!

いつもより時間がかかるので、pstree で見てみるといろいろやってるみたい、

$ ps auxw|grep yum|grep -v grep
root      4774 11.9  0.9 446356 148708 pts/0   S+   10:17   2:05 /usr/bin/python /usr/bin/yum update VirtualBox-4.3
$ watch pstree -alp 4774
yum,4774 /usr/bin/yum update VirtualBox-4.3
  └─sh,5134 /var/tmp/rpm-tmp.3nXBqe 2
      └─vboxdrv,5299 /etc/init.d/vboxdrv setup
          └─do_dkms,5322 /usr/share/virtualbox/src/vboxhost/do_dkms uninstall vboxhost vboxdrv vboxnetflt vboxnetadp
              └─do_dkms,5326 /usr/share/virtualbox/src/vboxhost/do_dkms uninstall vboxhost vboxdrv vboxnetflt vboxnetadp
                  └─dkms,5567 /usr/sbin/dkms remove -m vboxhost -v 4.3.20 --all
                      └─weak-modules,5791 /sbin/weak-modules --remove-modules
                          └─dracut,19128 /sbin/dracut -f /boot/initramfs-3.8.13-26.1.1.el6uek.x86_64.tmp 3.8.13-26.1.1.el6uek.x86_64
                              └─dracut,4739 /sbin/dracut -f /boot/initramfs-3.8.13-26.1.1.el6uek.x86_64.tmp 3.8.13-26.1.1.el6uek.x86_64
                                  ├─cpio,4746 -R 0:0 -H newc -o --quiet
                                  └─gzip,4747 -9

追記:

4.3.20 の時はゲストの Windows 7EXCEL を使っているとよくブルースクリーンになったが、4.3.22 で今のところ安定動作している。

2015-01-24

is not null で count する SQL を Index Only "Fast Full" Scan で高速化する

is not null で count する SQL を Index Only "Fast Full" Scan で仕事(計算)量を減らして高速化してみた。インデックスを作成すると、オプティマイザが期待していた仕事(計算)量が少なくなる実行計画を選択してくれた。


チューニング結果

ビフォー
17:36:30 SQL> alter system flush buffer_cache;

System altered.

Elapsed: 00:00:00.88
17:36:51 SQL> select count(c2) from test1 where c5 is not null;

 COUNT(C2)
----------
    100000

Elapsed: 00:00:05.70
17:37:11 SQL> select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID	6wksv9bxncxa5, child number 0
-------------------------------------
select count(c2) from test1 where c5 is not null

Plan hash value: 3896847026

-----------------------------------------------------------------------------------------------
| Id  | Operation	   | Name  | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
-----------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |	   |	  1 |	     |	    1 |00:00:05.65 |	5057 |	 5053 |
|   1 |  SORT AGGREGATE    |	   |	  1 |	   1 |	    1 |00:00:05.65 |	5057 |	 5053 |
|*  2 |   TABLE ACCESS FULL| TEST1 |	  1 |  21065 |	  100K|00:00:05.57 |	5057 |	 5053 |
-----------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("C5" IS NOT NULL)


19 rows selected.

Elapsed: 00:00:00.51
アフター
17:37:25 SQL> create index idx_test1 on test1(c2,c5);

Index created.

Elapsed: 00:00:43.33
17:45:46 SQL> alter system flush buffer_cache;

System altered.

Elapsed: 00:00:00.26
17:46:04 SQL> select count(c2) from test1 where c5 is not null;

 COUNT(C2)
----------
    100000

Elapsed: 00:00:00.66
17:46:14 SQL> select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID	6wksv9bxncxa5, child number 2
-------------------------------------
select count(c2) from test1 where c5 is not null

Plan hash value: 2671621383

------------------------------------------------------------------------------------------------------
| Id  | Operation	      | Name	  | Starts | E-Rows | A-Rows |	 A-Time   | Buffers | Reads  |
------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT      | 	  |	 1 |	    |	   1 |00:00:00.66 |    1032 |	1025 |
|   1 |  SORT AGGREGATE       | 	  |	 1 |	  1 |	   1 |00:00:00.66 |    1032 |	1025 |
|*  2 |   INDEX FAST FULL SCAN| IDX_TEST1 |	 1 |  21065 |	 100K|00:00:00.58 |    1032 |	1025 |
------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("C5" IS NOT NULL)


19 rows selected.

Elapsed: 00:00:00.32

準備手順

export LANG=C
export NLS_LANG=American_America.AL32UTF8
sqlplus /nolog
conn scott/tiger
set time on
set timing on
set pagesize 50000
set linesize 200

create table test1(c1 number, c2 char(30), c3 char(30), c4 char(30), c5 char(30));

begin
    for i in 1..1000000 loop
        insert into test1(c1, c2,c3,c4,c5) values(i,null,null,null,null);
    end loop;
end;
/
commit;

begin
for i in 100001..200000 loop
insert into test1(c1, c2,c3,c4,c5) values(i,i,i,i,i);
end loop;
end;
/
commit;

alter session set statistics_level=all;

環境

SQL> select * from V$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE	11.2.0.4.0	Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

最近使った Perl ワンライナーのメモ

perl -lane '$F[2]=~s/^([a-z]+).*/$1/; $h->{$F[1]}->{$F[2]}++;END{map{$t=$_ and print $t;map{print qq/$t\t$_\t$h->{$t}->{$_}/} keys %{$h->{$_}}} keys %$h}'' strace.log
grep -hA 20 '^top -' top.logperl -lane '/top - ([\d:]+)/ and $t=$1;$F[0]=~/\d+/ and printf (qq/%s %s%s\n/,$t,$_,lc(sprintf(q/%X/,$F[0])))'

chrome を 更新した

[root@yazekats-linux ~]# yum update google-chrome-stable

...

Updated:
  google-chrome-stable.x86_64 0:40.0.2214.91-1                                  

Complete!

[root@yazekats-linux ~]# cat /etc/issue
Oracle Linux Server release 6.4
Kernel \r on an \m

[root@yazekats-linux ~]# uname -r
2.6.39-400.17.1.el6uek.x86_64

"commit" and "log file sync"

When you commit a transaction you update the transaction table slot that identifies your transaction to show that the transaction is committed – this is a change to an undo segment header block so it generates a redo change vector. THe handling of this vector is completely standard – your session creates a redo record from it and puts the record into the log buffer – which means it is applied to the undo block at that moment, which means everyone can now see the effects of your transaction. AFTER the record is in the redo buffer your session will post lgwr to write the log buffer to the log file and goes into a “log file sync” wait. But this means (a) your transaction is visible to everyone else before it is recoverable (durable) and (b) you’re the only session that thinks the transaction hasn’t yet “really committed”.

Redo | Oracle Scratchpad

参考